From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20297 invoked by alias); 6 Jun 2014 21:31:08 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 20269 invoked by uid 48); 6 Jun 2014 21:31:08 -0000 From: "dje at google dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/17036] New: breakpoint reported on wrong line number Date: Fri, 06 Jun 2014 21:31:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dje at google dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q2/txt/msg00402.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=17036 Bug ID: 17036 Summary: breakpoint reported on wrong line number Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: dje at google dot com If one sets a breakpoint on a line with no debug information, the breakpoint gets set on the next line, but reported to the user as the line he requested. This is confusing. (gdb) break x.cc:8 Breakpoint 1 at 0x400633: file x.cc, line 8. but 0x400633 really corresponds to line 9, not line 8. It should print "Breakpoint 1 at 0x400633: file x.cc, line 9." (gdb) run Starting program: /tmp/x Breakpoint 1, main () at x.cc:9 9 g(); Testcase: void g() {} int f(int, int) { return 1; } int main(void) { int i = 0, j = 0; if (f(i, j)) g(); } Line number table, compiled with clang: Line Number Statements: Extended opcode 2: set Address to 0x4005d0 Copy Set prologue_end to true Special opcode 61: advance Address by 4 to 0x4005d4 and Line by 0 to 1 Special opcode 175: advance Address by 12 to 0x4005e0 and Line by 2 to 3 Set prologue_end to true Special opcode 215: advance Address by 15 to 0x4005ef and Line by 0 to 3 Advance PC by constant 17 to 0x400600 Special opcode 7: advance Address by 0 to 0x400600 and Line by 2 to 5 Set prologue_end to true Special opcode 216: advance Address by 15 to 0x40060f and Line by 1 to 6 Special opcode 202: advance Address by 14 to 0x40061d and Line by 1 to 7 Advance PC by constant 17 to 0x40062e Special opcode 77: advance Address by 5 to 0x400633 and Line by 2 to 9 Special opcode 76: advance Address by 5 to 0x400638 and Line by 1 to 10 Advance PC by 9 to 0x400641 Extended opcode 1: End of Sequence disas /m, easier to read: (gdb) disas /m Dump of assembler code for function main(): 5 int main(void) { 0x0000000000400600 <+0>: push %rbp 0x0000000000400601 <+1>: mov %rsp,%rbp 0x0000000000400604 <+4>: sub $0x10,%rsp 0x0000000000400608 <+8>: movl $0x0,-0x4(%rbp) 6 int i = 0, j = 0; 0x000000000040060f <+15>: movl $0x0,-0x8(%rbp) 0x0000000000400616 <+22>: movl $0x0,-0xc(%rbp) 7 if (f(i, 0x000000000040061d <+29>: mov -0x8(%rbp),%edi 0x0000000000400620 <+32>: mov -0xc(%rbp),%esi 0x0000000000400623 <+35>: callq 0x4005e0 0x0000000000400628 <+40>: cmp $0x0,%eax 0x000000000040062d <+45>: je 0x400638 8 j)) 9 g(); 0x0000000000400633 <+51>: callq 0x4005d0 10 } 0x0000000000400638 <+56>: mov -0x4(%rbp),%eax 0x000000000040063b <+59>: add $0x10,%rsp 0x000000000040063f <+63>: pop %rbp 0x0000000000400640 <+64>: retq End of assembler dump. google ref# 15455856 -- You are receiving this mail because: You are on the CC list for the bug.