diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/arch/arc.c | 1 | ||||
-rw-r--r-- | gdb/arch/loongarch.c | 1 | ||||
-rw-r--r-- | gdb/arch/riscv.c | 1 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 10 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 2 | ||||
-rw-r--r-- | gdb/infrun.c | 1 | ||||
-rw-r--r-- | gdb/linux-nat.c | 4 | ||||
-rw-r--r-- | gdb/riscv-tdep.c | 17 | ||||
-rw-r--r-- | gdb/solib-svr4.c | 7 | ||||
-rw-r--r-- | gdb/solib-svr4.h | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c | 18 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S | 23 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c | 18 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/i386-disp-step-self-call.S | 23 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp | 69 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/break-dbg.exp | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/style.exp | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/static-print-quit.exp | 23 | ||||
-rw-r--r-- | gdb/testsuite/gdb.multi/pending-bp.exp | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-cmd.exp | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/python.exp | 16 | ||||
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 11 |
22 files changed, 157 insertions, 132 deletions
diff --git a/gdb/arch/arc.c b/gdb/arch/arc.c index efe7111..b7de1da 100644 --- a/gdb/arch/arc.c +++ b/gdb/arch/arc.c @@ -17,7 +17,6 @@ #include "arc.h" -#include <stdlib.h> #include <unordered_map> #include <string> diff --git a/gdb/arch/loongarch.c b/gdb/arch/loongarch.c index 07c6d4d..25e698d 100644 --- a/gdb/arch/loongarch.c +++ b/gdb/arch/loongarch.c @@ -16,7 +16,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "loongarch.h" -#include <stdlib.h> #include <unordered_map> /* Target description features. */ diff --git a/gdb/arch/riscv.c b/gdb/arch/riscv.c index a6188ea..c698fa2 100644 --- a/gdb/arch/riscv.c +++ b/gdb/arch/riscv.c @@ -16,7 +16,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "riscv.h" -#include <stdlib.h> #include <unordered_map> #include "../features/riscv/32bit-cpu.c" diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 35b770f..2bbaf14 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -27659,6 +27659,16 @@ or a prompt that does not. @item set prompt @var{newprompt} Directs @value{GDBN} to use @var{newprompt} as its prompt string henceforth. +For example, this will set a blue-colored ``(gdb)'' prompt: + +@smallexample +set prompt \001\033[0;34m\002(gdb)\001\033[0m\002 +@end smallexample + +It uses @samp{\001} and @samp{\002} to begin and end a sequence of +non-printing characters, to make sure they're not counted in the string +length. + @kindex show prompt @item show prompt Prints a line of the form: @samp{Gdb's prompt is: @var{your-prompt}} diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index b50a7c3..f97c98e 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -60,9 +60,7 @@ #include "stap-probe.h" #include "user-regs.h" -#include "cli/cli-utils.h" #include "expression.h" -#include "parser-defs.h" #include <ctype.h> #include <algorithm> #include <unordered_set> diff --git a/gdb/infrun.c b/gdb/infrun.c index 05bf6ab..9d3e1b7 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -67,7 +67,6 @@ #include "gdbsupport/scope-exit.h" #include "gdbsupport/forward-scope-exit.h" #include "gdbsupport/gdb_select.h" -#include <unordered_map> #include "async-event.h" #include "gdbsupport/selftest.h" #include "scoped-mock-context.h" diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 70f77fd..f317927 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -51,17 +51,13 @@ #include <pwd.h> #include <sys/types.h> #include <dirent.h> -#include "xml-support.h" #include <sys/vfs.h> -#include "solib.h" #include "nat/linux-osdata.h" #include "linux-tdep.h" -#include "symfile.h" #include "gdbsupport/agent.h" #include "tracepoint.h" #include "target-descriptions.h" #include "gdbsupport/filestuff.h" -#include "objfiles.h" #include "nat/linux-namespaces.h" #include "gdbsupport/block-signals.h" #include "gdbsupport/fileio.h" diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 6d439b0..f5b8523 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -4163,6 +4163,20 @@ riscv_gnu_triplet_regexp (struct gdbarch *gdbarch) return "riscv(32|64)?"; } +/* Implement the "print_insn" gdbarch method. */ + +static int +riscv_print_insn (bfd_vma addr, struct disassemble_info *info) +{ + /* Initialize the BFD section to enable ISA string detection depending on the + object in scope. */ + struct obj_section *s = find_pc_section (addr); + if (s != nullptr) + info->section = s->the_bfd_section; + + return default_print_insn (addr, info); +} + /* Implementation of `gdbarch_stap_is_single_operand', as defined in gdbarch.h. */ @@ -4429,6 +4443,9 @@ riscv_gdbarch_init (struct gdbarch_info info, disassembler_options_riscv ()); set_gdbarch_disassembler_options (gdbarch, &riscv_disassembler_options); + /* Disassembler print_insn. */ + set_gdbarch_print_insn (gdbarch, riscv_print_insn); + /* SystemTap Support. */ set_gdbarch_stap_is_single_operand (gdbarch, riscv_stap_is_single_operand); set_gdbarch_stap_register_indirection_prefixes diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index e454254..fab84c9 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -3720,11 +3720,8 @@ svr4_solib_ops::get_solibs_in_ns (int nsid) const CORE_ADDR debug_base = info->namespace_id[nsid]; std::unordered_map<std::string, const lm_info_svr4 *> namespace_solibs; for (svr4_so &so : info->solib_lists[debug_base]) - { - namespace_solibs[so.name] - = gdb::checked_static_cast<const lm_info_svr4 *> - (so.lm_info.get ()); - } + namespace_solibs[so.name] = so.lm_info.get (); + for (const solib &so: current_program_space->solibs ()) { auto *lm_inferior diff --git a/gdb/solib-svr4.h b/gdb/solib-svr4.h index b331fa7..7235fd9 100644 --- a/gdb/solib-svr4.h +++ b/gdb/solib-svr4.h @@ -111,7 +111,6 @@ private: void create_event_breakpoints (svr4_info *info, gdbarch *gdbarch, CORE_ADDR address) const; int enable_break (svr4_info *info, int from_tty) const; - bool is_default_namespace (CORE_ADDR debug_base) const; void free_probes_table (svr4_info *info) const; CORE_ADDR find_r_brk (svr4_info *info) const; CORE_ADDR find_r_ldsomap (svr4_info *info) const; @@ -123,22 +122,15 @@ private: CORE_ADDR lm_addr_check (const solib &so, bfd *abfd) const; CORE_ADDR read_r_next (CORE_ADDR debug_base) const; CORE_ADDR read_r_map (CORE_ADDR debug_base) const; - int parse_libraries (const char *document, svr4_library_list *list); - int current_sos_via_xfer_libraries (svr4_library_list *list, - const char *annex) const; owning_intrusive_list<solib> collect_probes_sos (svr4_info *info) const; owning_intrusive_list<solib> current_sos_1 (svr4_info *info) const; owning_intrusive_list<solib> solibs_from_svr4_sos (const std::vector<svr4_so> &sos) const; - void register_event_probe (objfile *objfile, probe *prob, CORE_ADDR address, - enum probe_action action) const; void disable_probes_interface (svr4_info *info) const; - probe_and_action *event_probe_at (CORE_ADDR address) const; void update_full (svr4_info *info) const; int update_incremental (svr4_info *info, CORE_ADDR debug_base, CORE_ADDR lm) const; bool update_event_breakpoint (breakpoint *b) const; - CORE_ADDR find_debug_base (const solib *solib) const; }; /* solib_ops for ILP32 SVR4 systems. */ diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c index 03b868c..0fb2904 100644 --- a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c +++ b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c @@ -16,9 +16,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <unistd.h> +#include <stdlib.h> + +extern void test_call (void); + +void +unreachable (void) +{ + abort (); +} void setup_alarm (void) { alarm (300); } + +int +main () +{ + setup_alarm (); + test_call (); + unreachable (); + return 0; +} diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S index 78a6859..20a8eb7 100644 --- a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S +++ b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S @@ -18,33 +18,12 @@ handling. */ .text - - .global main -main: - nop - - callq setup_alarm - - nop - -/***********************************************/ - -/* test call/ret */ - .global test_call test_call: call test_call - nop + call unreachable .global test_ret_end test_ret_end: nop -/***********************************************/ - -/* all done */ - -done: - mov $0,%rdi - call exit - hlt .section .note.GNU-stack,"",@progbits diff --git a/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c b/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c index 03b868c..0fb2904 100644 --- a/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c +++ b/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c @@ -16,9 +16,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <unistd.h> +#include <stdlib.h> + +extern void test_call (void); + +void +unreachable (void) +{ + abort (); +} void setup_alarm (void) { alarm (300); } + +int +main () +{ + setup_alarm (); + test_call (); + unreachable (); + return 0; +} diff --git a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S index 466e50c..20a8eb7 100644 --- a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S +++ b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S @@ -18,33 +18,12 @@ handling. */ .text - - .global main -main: - nop - - call setup_alarm - - nop - -/***********************************************/ - -/* test call/ret */ - .global test_call test_call: call test_call - nop + call unreachable .global test_ret_end test_ret_end: nop -/***********************************************/ - -/* all done */ - -done: - pushl $0 - call exit - hlt .section .note.GNU-stack,"",@progbits diff --git a/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp b/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp index 53bf642..fce6d67 100644 --- a/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp +++ b/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp @@ -31,7 +31,7 @@ proc prepare_test {has_cfi} { "${objcallerfile}" \ object [list {additional_flags=-fomit-frame-pointer \ -funwind-tables -fasynchronous-unwind-tables}]] != "" } { - untested "couldn't compile with cfi" + untested "couldn't compile" return false } } else { @@ -41,7 +41,7 @@ proc prepare_test {has_cfi} { object [list {additional_flags=-fomit-frame-pointer \ -fno-unwind-tables \ -fno-asynchronous-unwind-tables}]] != "" } { - untested "couldn't compile without cfi" + untested "couldn't compile" return false } } @@ -54,15 +54,12 @@ proc prepare_test {has_cfi} { clean_restart "$binfile-${extension}" - with_test_prefix "${extension}" { - - if ![runto callback] then { - fail "has_cfi=$has_cfi: Can't run to callback" - return false - } - gdb_test_no_output "maint frame-unwinder disable ARCH" - return true + if ![runto callback] then { + fail "has_cfi=$has_cfi: Can't run to callback" + return false } + gdb_test_no_output "maint frame-unwinder disable ARCH" + return true } if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" \ @@ -72,15 +69,45 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" \ return } -if { [prepare_test false] } { - gdb_test "bt" \ +proc_with_prefix no-cfi {} { + if { ![prepare_test false] } { + return + } + + set re_msg \ + [string_list_to_regexp \ + "Required frame unwinder may have been disabled," \ + " see 'maint info frame-unwinders'"] + set hs {[^\r\n]} + set re_bt_line "#0\\s+[string_to_regexp {callback ()}] $hs+" + set re_bt_no_filters \ [multi_line \ - "\[^\r\n\]+Required frame unwinder may have been disabled, \[^\r\n\]+" \ - "#0\\s+callback \\(\\) \[^\r\n\]+"] \ - "verify unwind fail without CFI" + $re_bt_line \ + $re_msg] + gdb_test "bt -no-filters" \ + $re_bt_no_filters \ + "verify no-filters unwind fail" + + # Flush frame cache to retrigger the message. + gdb_test "maint flush register-cache" \ + [string_to_regexp "Register cache flushed."] + + # This output may occur when we run into the message while applying the + # frame filters. + set re_bt \ + [multi_line \ + $hs+$re_msg \ + $re_bt_line] + gdb_test "bt" \ + "($re_bt|$re_bt_no_filters)" \ + "verify unwind fail" } -if { [prepare_test true] } { +proc_with_prefix cfi {} { + if { ![prepare_test true] } { + return + } + if { [istarget "arm*-*-*"] } { setup_kfail backtrace/31950 *-*-* } @@ -89,6 +116,12 @@ if { [prepare_test true] } { # #1 0x00000000004004e9 in caller () # #2 0x00000000004004cd in main () at ... gdb_test "bt" \ - "#0 +callback $text\r\n#1 $text in caller $text\r\n#2 $text in main $text" \ - "Verify unwinding works based only on CFI information" + [multi_line \ + "#0 +callback $text" \ + "#1 $text in caller $text" \ + "#2 $text in main $text"] \ + "Verify unwinding works" } + +no-cfi +cfi diff --git a/gdb/testsuite/gdb.base/break-dbg.exp b/gdb/testsuite/gdb.base/break-dbg.exp index 3652b8e..a7c7d92 100644 --- a/gdb/testsuite/gdb.base/break-dbg.exp +++ b/gdb/testsuite/gdb.base/break-dbg.exp @@ -46,7 +46,17 @@ gdb_test "catch load" "^Catchpoint $decimal \\(load\\)" gdb_test "catch unload" "^Catchpoint $decimal \\(unload\\)" gdb_test "catch signal" "^Catchpoint $decimal \\(standard signals\\)" -gdb_test "catch syscall" "^Catchpoint $decimal \\(any syscall\\)" + +set re_warning_xml_disabled \ + [string_to_regexp \ + [join \ + [list \ + "warning: Can not parse XML syscalls information;" \ + "XML support was disabled at compile time."]]] +gdb_test "catch syscall" \ + [multi_line \ + "^($re_warning_xml_disabled" \ + ")?Catchpoint $decimal [string_to_regexp {(any syscall)}]"] gdb_test "watch -l global_var" "\[Ww]atchpoint $decimal: -location global_var" diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp index 503671b..47efb64 100644 --- a/gdb/testsuite/gdb.base/style.exp +++ b/gdb/testsuite/gdb.base/style.exp @@ -859,7 +859,7 @@ proc previous_line_is_ok { str } { # For lines that don't match this pattern, we cannot comment on # where the style reset should occur, so lets just claim the line # is fine. - if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in " $str] } { + if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in \033" $str] } { return true } @@ -923,8 +923,14 @@ proc test_pagination_prompt_styling {} { } } + if { $desired_width < [string length $::pagination_prompt_str] + 2 } { + # Avoid readline wrapping after printing the pagination prompt. + return + } + # Now setup the screen width. - gdb_test_no_output "set width $desired_width" + gdb_test_no_output "set width $desired_width" \ + "set width to desired width" # Re-run 'info files'. Check that the content before any # pagination prompt correctly disables styling. diff --git a/gdb/testsuite/gdb.cp/static-print-quit.exp b/gdb/testsuite/gdb.cp/static-print-quit.exp index 8e0b61d..e4bce7f 100644 --- a/gdb/testsuite/gdb.cp/static-print-quit.exp +++ b/gdb/testsuite/gdb.cp/static-print-quit.exp @@ -27,32 +27,17 @@ clean_restart $testfile.o gdb_test_no_output "set width 80" gdb_test_no_output "set height 2" -set test "print c - <return>" -gdb_test_multiple "print c" $test { - -re "\\$\[0-9\]+ = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n--Type <RET>" { - pass $test +gdb_test_multiple "print c" "" { + -re "\\$\[0-9\]+ = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n$pagination_prompt$" { + pass $gdb_test_name } - -re "\r\n--Type <RET>" { + -re "\r\n$pagination_prompt$" { # gdb-7.1 did not crash with this testcase but it had the same bug. untested "bug does not reproduce" return 0 } } -set test "print c - q <return>" -gdb_test_multiple "" $test { - -re " for more, q to quit, " { - pass $test - } -} - -set test "print c - remainder" -gdb_test_multiple "" $test { - -re "c to continue without paging--$" { - pass $test - } -} - gdb_test "q" ".*" # Now the obstack is uninitialized. Exercise it. diff --git a/gdb/testsuite/gdb.multi/pending-bp.exp b/gdb/testsuite/gdb.multi/pending-bp.exp index 1cd1cfb..2458cd7 100644 --- a/gdb/testsuite/gdb.multi/pending-bp.exp +++ b/gdb/testsuite/gdb.multi/pending-bp.exp @@ -328,5 +328,7 @@ proc_with_prefix py_test_clear_thread {} { # Run all the tests. test_no_inf_display test_pending_toggle -py_test_toggle_thread -py_test_clear_thread +if { [allow_python_tests] } { + py_test_toggle_thread + py_test_clear_thread +} diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp index 5ac5712..1fa3c73 100644 --- a/gdb/testsuite/gdb.python/py-cmd.exp +++ b/gdb/testsuite/gdb.python/py-cmd.exp @@ -278,13 +278,7 @@ gdb_test_multiline "input multi-line-output command" \ set test "verify pagination from test_multiline" gdb_test_multiple "test_multiline" $test { - -re "--Type <RET>" { - exp_continue - } - -re " for more, q to quit" { - exp_continue - } - -re ", c to continue without paging--$" { + -re "$pagination_prompt$" { pass $test } } diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index 6b2f671..96977df 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -152,13 +152,7 @@ gdb_test_no_output "set height $lines" set test "verify pagination beforehand" gdb_test_multiple "python print (\"\\n\" * $lines)" $test { - -re "--Type <RET>" { - exp_continue - } - -re " for more, q to quit" { - exp_continue - } - -re ", c to continue without paging--$" { + -re "$pagination_prompt$" { pass $test } } @@ -168,13 +162,7 @@ gdb_test "python if gdb.execute('python print (\"\\\\n\" * $lines)', to_string=T set test "verify pagination afterwards" gdb_test_multiple "python print (\"\\n\" * $lines)" $test { - -re "--Type <RET>" { - exp_continue - } - -re " for more, q to quit" { - exp_continue - } - -re ", c to continue without paging--$" { + -re "$pagination_prompt$" { pass $test } } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 777d64d..8d94d6b 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -287,10 +287,13 @@ if {![info exists gdb_prompt]} { set gdb_prompt "\\(gdb\\)" } -# A regexp that matches the pagination prompt. -set pagination_prompt \ +# The pagination prompt. +set pagination_prompt_str \ "--Type <RET> for more, q to quit, c to continue without paging--" +# A regexp that matches the pagination prompt. +set pagination_prompt [string_to_regexp $pagination_prompt_str] + # The variable fullname_syntax_POSIX is a regexp which matches a POSIX # absolute path ie. /foo/ set fullname_syntax_POSIX {/[^\n]*/} @@ -9990,6 +9993,10 @@ proc gdb_stdin_log_init { } { set logfile [standard_output_file_with_gdb_instance gdb.in] set in_file [open $logfile w] + + verbose -log "" + verbose -log "Starting logfile: $logfile" + verbose -log "" } # Write to the file for logging gdb input. |