diff options
author | Keith Seitz <keiths@redhat.com> | 2017-10-27 10:57:23 -0700 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2017-10-27 10:57:23 -0700 |
commit | 4a27f119f59a44395e0a34b1526cee709e1d3fce (patch) | |
tree | 8912ee8ce9e4dc2569dc33ca943fc2b09ce3e830 /gdb/breakpoint.h | |
parent | bb11dd58391459bd5ba54ec405adab663ac59e89 (diff) | |
download | binutils-gdb-4a27f119f59a44395e0a34b1526cee709e1d3fce.tar.gz |
Use SaL symbol name when reporting breakpoint locations
Currently, "info break" can show some (perhaps) unexpected results when
setting a breakpoint on an inlined function:
(gdb) list
1 #include <stdio.h>
2
3 static inline void foo()
4 {
5 printf("Hello world\n");
6 }
7
8 int main()
9 {
10 foo();
11 return 0;
12 }
13
(gdb) b foo
Breakpoint 1 at 0x400434: file foo.c, line 5.
(gdb) i b
Num Type Disp Enb Address What
1 breakpoint keep y 0x0000000000400434 in main at foo.c:5
GDB reported that we understood what "foo" was, but we then report that the
breakpoint is actually set in main. While that is literally true, we can
do a little better.
This is accomplished by copying the symbol for which the breakpoint was set
into the bp_location. From there, print_breakpoint_location can use this
information to print out symbol information (if available) instead of calling
find_pc_sect_function.
With the patch installed,
(gdb) i b
Num Type Disp Enb Address What
1 breakpoint keep y 0x0000000000400434 in foo at foo.c:5
gdb/ChangeLog:
* breakpoint.c (print_breakpoint_location): Use the symbol saved
in the bp_location, falling back to find_pc_sect_function when
needed.
(add_location_to_breakpoint): Save sal->symbol.
* breakpoint.h (struct bp_location) <symbol>: New field.
* symtab.c (find_function_start_sal): Save the symbol into the SaL.
* symtab.h (struct symtab_and_line) <symbol>: New field.
gdb/testsuite/ChangeLog:
* gdb.opt/inline-break.exp (break_info_1): New procedure.
Test "info break" for every inlined function breakpoint.
Diffstat (limited to 'gdb/breakpoint.h')
-rw-r--r-- | gdb/breakpoint.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index c91fccab73a..9a9433bd661 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -486,6 +486,11 @@ public: to find the corresponding source file name. */ struct symtab *symtab = NULL; + + /* The symbol found by the location parser, if any. This may be used to + ascertain when an event location was set at a different location than + the one originally selected by parsing, e.g., inlined symbols. */ + const struct symbol *symbol = NULL; }; /* The possible return values for print_bpstat, print_it_normal, |