diff options
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/elfread.c | 3 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/gnu-ifunc.exp | 18 |
4 files changed, 27 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5916889..6164fc3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2018-04-26 Pedro Alves <palves@redhat.com> + * elfread.c (elf_gnu_ifunc_resolver_return_stop): Use + find_function_start_sal instead of find_pc_line. + +2018-04-26 Pedro Alves <palves@redhat.com> + * breakpoint.c (set_breakpoint_location_function): Handle mst_data_gnu_ifunc. * c-exp.y (variable production): Handle mst_data_gnu_ifunc. diff --git a/gdb/elfread.c b/gdb/elfread.c index e724f34..e7925a3 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1026,7 +1026,8 @@ elf_gnu_ifunc_resolver_return_stop (struct breakpoint *b) b->type = bp_breakpoint; update_breakpoint_locations (b, current_program_space, - find_pc_line (resolved_pc, 0), {}); + find_function_start_sal (resolved_pc, NULL, true), + {}); } /* A helper function for elf_symfile_read that reads the minimal diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 29ae9b2..34da102 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2018-04-26 Pedro Alves <palves@redhat.com> + * gdb.base/gnu-ifunc.exp (set-break): Test that GDB resolves + ifunc breakpoint locations correctly of ifunc breakpoints set + while the program resolves the ifunc. + +2018-04-26 Pedro Alves <palves@redhat.com> + * gdb.base/gnu-ifunc-final.c: New file. * gdb.base/gnu-ifunc.c (final): Delete, moved to gnu-ifunc-final.c. * gdb.base/gnu-ifunc.exp (executable): Delete. diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.exp b/gdb/testsuite/gdb.base/gnu-ifunc.exp index 827ac12..d6ec698 100644 --- a/gdb/testsuite/gdb.base/gnu-ifunc.exp +++ b/gdb/testsuite/gdb.base/gnu-ifunc.exp @@ -106,6 +106,9 @@ proc_with_prefix set-break {resolver_attr resolver_debug final_debug} { return 1 } + gdb_breakpoint [gdb_get_line_number "break-at-call"] + gdb_continue_to_breakpoint "break-at-call" ".*break-at-call.*" + set ws "\[ \t\]+" set dot "\\.?" @@ -131,19 +134,21 @@ proc_with_prefix set-break {resolver_attr resolver_debug final_debug} { "Breakpoint $decimal at gnu-indirect-function resolver at $hex" gdb_test "info breakpoints" \ "$decimal${ws}STT_GNU_IFUNC resolver${ws}keep${ws}y${ws}$hex <${gnu_ifunc_resolver}>" + + # Make the breakpoint conditional on a condition that always + # fails. This is so that when the ifunc-resolver breakpoint + # triggers, GDB resumes the program immediately. + gdb_test_no_output "condition \$bpnum 0" } global final_src with_test_prefix "resolve" { - delete_breakpoints gdb_breakpoint [gdb_get_line_number "break-at-exit"] gdb_continue_to_breakpoint "break-at-exit" ".*break-at-exit.*" } with_test_prefix "after resolving" { - delete_breakpoints - if {!$final_debug} { # Set a breakpoint both at the ifunc, and at the ifunc's # target. GDB should resolve both to the same address. @@ -176,7 +181,12 @@ proc_with_prefix set-break {resolver_attr resolver_debug final_debug} { gdb_test "break gnu_ifunc" "Breakpoint .* at $hex: file .*$final_src, line $lineno\\." set location "$decimal${ws}breakpoint${ws}keep${ws}y${ws}$hex in final at .*$final_src:$lineno" } - gdb_test "info breakpoints" "$location\r\n$location" + + # The first location here is for the breakpoint that was set + # before the ifunc was resolved. It should be resolved by + # now, and it should have the exact same address/line as the + # other two locations. + gdb_test "info breakpoints" "$location\r\n.*$location\r\n$location" } } |