mi_clean_restart $binfile
+set readnow_p [mi_readnow]
+
mi_runto_main
+# Unload symbols for shared libraries to prevent
+# 'ERROR: internal buffer is full'.
+mi_gdb_test "nosharedlibrary" ".*\\^done" "nosharedlibrary"
+
# Helper to build expected MI output pattern for a list. NAME is the
# name of the list (which can be the empty string) and args is one
# or more strings representing the fields of the list, which will be
with_test_prefix "debug_read=${debug_fully_read}" {
if { $debug_fully_read } {
- set p [mi_list "files" \
- [mi_tuple "" \
- [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \
- [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \
- [mi_field "debug-fully-read" "${debug_fully_read}"]] \
- [mi_tuple "" \
- [mi_field "file" "\[^\"\]+/mi-info-sources\\.c"] \
- [mi_field "fullname" "\[^\"\]+/mi-info-sources\\.c"] \
- [mi_field "debug-fully-read" "true"]]]
+ set p1 \
+ [mi_list "files" \
+ ".*" \
+ [mi_tuple "" \
+ [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \
+ [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \
+ [mi_field "debug-fully-read" "${debug_fully_read}"]] \
+ ".*"]
+ set p2 \
+ [mi_list "files" \
+ ".*" \
+ [mi_tuple "" \
+ [mi_field "file" "\[^\"\]+/mi-info-sources\\.c"] \
+ [mi_field "fullname" "\[^\"\]+/mi-info-sources\\.c"] \
+ [mi_field "debug-fully-read" "true"]] \
+ ".*"]
} else {
- set p [mi_list "files" \
- [mi_tuple "" \
- [mi_field "file" "\[^\"\]+/mi-info-sources\\.c"] \
- [mi_field "fullname" "\[^\"\]+/mi-info-sources\\.c"] \
- [mi_field "debug-fully-read" "true"]] \
- [mi_tuple "" \
- [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \
- [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \
- [mi_field "debug-fully-read" "${debug_fully_read}"]]]
+ set p1 \
+ [mi_list "files" \
+ ".*" \
+ [mi_tuple "" \
+ [mi_field "file" "\[^\"\]+/mi-info-sources\\.c"] \
+ [mi_field "fullname" "\[^\"\]+/mi-info-sources\\.c"] \
+ [mi_field "debug-fully-read" "true"]] \
+ ".*"]
+ set p2 \
+ [mi_list "files" \
+ ".*" \
+ [mi_tuple "" \
+ [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \
+ [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \
+ [mi_field "debug-fully-read" "${debug_fully_read}"]] \
+ ".*"]
}
- mi_gdb_test "-file-list-exec-source-files" ".*\\^done,${p}" "-file-list-exec-source-files"
+
+ mi_gdb_test "-file-list-exec-source-files" ".*\\^done,${p1}" \
+ "-file-list-exec-source-files, src1"
+ mi_gdb_test "-file-list-exec-source-files" ".*\\^done,${p2}" \
+ "-file-list-exec-source-files, src2"
set p [mi_list "files" \
[mi_tuple "" \
set p [mi_list "files" \
[mi_tuple "" \
- [mi_field "filename" "\[^\"\]+/mi-info-sources"] \
+ [mi_field "filename" "\[^\"\]+/mi-info-sources(\.debug)?"] \
[mi_field "debug-info" "${debug_info}"] \
[mi_list "sources" \
".*" \
set p [mi_list "files" \
[mi_tuple "" \
- [mi_field "filename" "\[^\"\]+/mi-info-sources"] \
+ [mi_field "filename" "\[^\"\]+/mi-info-sources(\.debug)?"] \
[mi_field "debug-info" "${debug_info}"] \
[mi_list "sources" \
".*" \
}
}
-check_info_sources "false"
+if { ! $readnow_p } {
+ check_info_sources "false"
+}
mi_continue_to "some_other_func"
+# Force "fully-read".
+mi_gdb_test "maint expand-symtabs"
+
check_info_sources "true"
return 0
}
+# Return 1 if symbols were read in using -readnow. Otherwise, return 0.
+# Based on readnow from lib/gdb.exp.
+
+proc mi_readnow { args } {
+ global mi_gdb_prompt
+
+ if { [llength $args] == 1 } {
+ set re [lindex $args 0]
+ } else {
+ set re ""
+ }
+
+ set readnow_p 0
+ set cmd "maint print objfiles $re"
+ send_gdb "$cmd\n"
+ gdb_expect {
+ -re ".gdb_index: faked for ..readnow.." {
+ # Record that we've seen the above pattern.
+ set readnow_p 1
+ exp_continue
+ }
+ -re "\\^done\r\n$mi_gdb_prompt$" {
+ }
+ }
+
+ return $readnow_p
+}
+
# mi_gdb_test COMMAND PATTERN MESSAGE [IPATTERN] -- send a command to gdb;
# test the result.
#