mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 03:51:15 +08:00
gdb: Add maint set ignore-prologue-end-flag
The previous patch added support for the DWARF prologue-end flag in line table. This flag can be used by DWARF producers to indicate where to place breakpoints past a function prologue. However, this takes precedence over prologue analyzers. So if we have to debug a program with erroneous debug information, the overall debugging experience will be degraded. This commit proposes to add a maintenance command to instruct GDB to ignore the prologue_end flag. Tested on x86_64-gnu-linux. Change-Id: Idda6d1b96ba887f4af555b43d9923261b9cc6f82
This commit is contained in:
parent
cc96ae7f88
commit
6109f7a39e
9
gdb/NEWS
9
gdb/NEWS
@ -14,6 +14,15 @@
|
||||
emit to indicate where a breakpoint should be placed to break in a function
|
||||
past its prologue.
|
||||
|
||||
* New commands
|
||||
|
||||
maintenance set ignore-prologue-end-flag on|off
|
||||
maintenance show ignore-prologue-end-flag
|
||||
This setting, which is off by default, controls whether GDB ignores the
|
||||
PROLOGUE-END flag from the line-table when skipping prologue. This can be
|
||||
used to force GDB to use prologue analyzers if the line-table is constructed
|
||||
from erroneous debug information.
|
||||
|
||||
* Changed commands
|
||||
|
||||
maintenance info line-table
|
||||
|
@ -19857,6 +19857,19 @@ when collecting performance data. The command @code{maint
|
||||
flush-symbol-cache} is deprecated in favor of @code{maint flush
|
||||
symbol-cache}..
|
||||
|
||||
@kindex maint set ignore-prologue-end-flag
|
||||
@cindex prologue-end
|
||||
@item maint set ignore-prologue-end-flag [on|off]
|
||||
Enable or disable the use of the @samp{PROLOGUE-END} flag from the line-table.
|
||||
When @samp{off} (the default), @value{GDBN} uses the @samp{PROLOGUE-END} flag
|
||||
to place breakpoints past the end of a function prologue. When @samp{on},
|
||||
@value{GDBN} ignores the flag and relies on prologue analyzers to skip function
|
||||
prologues.
|
||||
|
||||
@kindex maint show ignore-prologue-end-flag
|
||||
@item maint show ignore-prologue-end-flag
|
||||
Show whether @value{GDBN} will ignore the @samp{PROLOGUE-END} flag.
|
||||
|
||||
@end table
|
||||
|
||||
@node Altering
|
||||
|
19
gdb/symtab.c
19
gdb/symtab.c
@ -288,6 +288,10 @@ static const char *const multiple_symbols_modes[] =
|
||||
};
|
||||
static const char *multiple_symbols_mode = multiple_symbols_all;
|
||||
|
||||
/* When TRUE, ignore the prologue-end flag in linetable_entry when searching
|
||||
for the SAL past a function prologue. */
|
||||
static bool ignore_prologue_end_flag = false;
|
||||
|
||||
/* Read-only accessor to AUTO_SELECT_MODE. */
|
||||
|
||||
const char *
|
||||
@ -3941,7 +3945,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
|
||||
|
||||
/* Check if the compiler explicitly indicated where a breakpoint should
|
||||
be placed to skip the prologue. */
|
||||
if (skip)
|
||||
if (!ignore_prologue_end_flag && skip)
|
||||
{
|
||||
gdb::optional<CORE_ADDR> linetable_pc
|
||||
= skip_prologue_using_linetable (pc);
|
||||
@ -7113,6 +7117,19 @@ If zero then the symbol cache is disabled."),
|
||||
&maintenance_set_cmdlist,
|
||||
&maintenance_show_cmdlist);
|
||||
|
||||
add_setshow_boolean_cmd ("ignore-prologue-end-flag", no_class,
|
||||
&ignore_prologue_end_flag,
|
||||
_("Set if the PROLOGUE-END flag is ignored."),
|
||||
_("Show if the PROLOGUE-END flag is ignored."),
|
||||
_("\
|
||||
The PROLOGUE-END flag from the line-table entries is used to place \
|
||||
breakpoints past the prologue of functions. Disabeling its use use forces \
|
||||
the use of prologue scanners."),
|
||||
nullptr, nullptr,
|
||||
&maintenance_set_cmdlist,
|
||||
&maintenance_show_cmdlist);
|
||||
|
||||
|
||||
add_cmd ("symbol-cache", class_maintenance, maintenance_print_symbol_cache,
|
||||
_("Dump the symbol cache for each program space."),
|
||||
&maintenanceprintlist);
|
||||
|
@ -89,3 +89,17 @@ if ![runto_main] {
|
||||
|
||||
set prologue_end_line [gdb_get_line_number "main assign o"]
|
||||
gdb_test "frame" ".*main \\\(\\\) at \[^\r\n\]*:$prologue_end_line\r\n.*"
|
||||
|
||||
with_test_prefix "ignore-prologue-end" {
|
||||
clean_restart $binfile
|
||||
gdb_test_no_output "maintenance set ignore-prologue-end-flag on"
|
||||
|
||||
if ![runto_main] {
|
||||
return -1
|
||||
}
|
||||
|
||||
# If we ignore the prologue-end flag, we should stop at the first statement
|
||||
# of main which assigns m.
|
||||
set prologue_end_line [gdb_get_line_number "main assign m"]
|
||||
gdb_test "frame" ".*main \\\(\\\) at \[^\r\n\]*:$prologue_end_line\r\n.*"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user