public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug breakpoints/26546] New: [pie] Setting breakpoint on missing label sets breakpoint at offset 0 in NULL section Date: Fri, 28 Aug 2020 10:27:36 +0000 [thread overview] Message-ID: <bug-26546-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=26546 Bug ID: 26546 Summary: [pie] Setting breakpoint on missing label sets breakpoint at offset 0 in NULL section Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: breakpoints Assignee: unassigned at sourceware dot org Reporter: vries at gcc dot gnu.org Target Milestone: --- Say we modify test-case label-without-address.exp like this: ... diff --git a/gdb/testsuite/gdb.base/label-without-address.exp b/gdb/testsuite/g db.base/label-without-address.exp index 0fcb1fd19a..2f05099f3a 100644 --- a/gdb/testsuite/gdb.base/label-without-address.exp +++ b/gdb/testsuite/gdb.base/label-without-address.exp @@ -19,6 +19,15 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { return -1 } +gdb_test "p main" + +if ![runto_main] then { + fail "can't run to main" + return 0 +} + +gdb_test "p main" + set supported 0 gdb_test_multiple "l main:L1" "" { -wrap -re "No label \"L1\" defined in function \"main\"\." { ... and run with target_board unix/-fPIE/-pie, we get: ... (gdb) break main:L1^M Breakpoint 2 at 0x555555554000: file label-without-address.c, line 22.^M ... Looking at the addresses of main before: (gdb) p main^M $1 = {int (void)} 0x63a <main>^M ... and after relocation: ... (gdb) p main^M $2 = {int (void)} 0x55555555463a <main>^M ... it becomes obvious that 0x55555555463a - 0x63a == 0x555555554000 is the relocation base, so we're setting a breakpoint at offset 0, in the NULL section: ... $ readelf -S outputs/gdb.base/label-without-address/label-without-address There are 37 section headers, starting at offset 0x2948: Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 ... Indeed, the label has no address: ... <2><115>: Abbrev Number: 3 (DW_TAG_label) <116> DW_AT_name : L1 <119> DW_AT_decl_file : 1 <11a> DW_AT_decl_line : 22 <2><11b>: Abbrev Number: 0 ... and the line number doesn't match anything: ... CU: /home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/label-without-address.c: File name Line number Starting address View Stmt label-without-address.c 20 0x63a x label-without-address.c 21 0x63e x label-without-address.c 24 0x643 x label-without-address.c - 0x645 ... -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2020-08-28 10:27 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-28 10:27 vries at gcc dot gnu.org [this message] 2020-08-28 11:33 ` [Bug breakpoints/26546] " vries at gcc dot gnu.org 2020-09-03 10:30 ` cvs-commit at gcc dot gnu.org 2020-09-03 10:31 ` vries at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-26546-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).