public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "jaydeepchauhan1494 at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/26538] New: Line number zero in line table gives incorrect debugging experince with gdb
Date: Wed, 26 Aug 2020 08:07:18 +0000 [thread overview]
Message-ID: <bug-26538-4717@http.sourceware.org/bugzilla/> (raw)
https://sourceware.org/bugzilla/show_bug.cgi?id=26538
Bug ID: 26538
Summary: Line number zero in line table gives incorrect
debugging experince with gdb
Product: gdb
Version: HEAD
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: jaydeepchauhan1494 at gmail dot com
Target Milestone: ---
Created attachment 12798
--> https://sourceware.org/bugzilla/attachment.cgi?id=12798&action=edit
Attached Assembly file.
Hi Everyone,
We have a situation with GDB(latest trunk) and below testcase referred for
further discussion :
$ cat gdb.c
1 /* demo testcase */
2 int garr[2];
3 int main() {
4
5 if((garr[0] && garr[1])==0){
6 garr[0]=1;
7 garr[1]=1;
8 }
9 else {
10 garr[0]=2;
11 garr[1]=2;
12 }
13 printf("%d %d\n",garr[0], garr[1]);
14 return 0;
15 }
$clang -target arm64 -g -c gdb.c
$./llvm-dwarfdump --debug-line gdb.o
...
...
Address Line Column File ISA Discriminator Flags
------------------ ------ ------ ------ --- ------------- -------------
0x0000000000000000 3 0 1 0 0 is_stmt
0x000000000000000c 0 0 1 0 0 is_stmt prologue_end
0x000000000000001c 5 13 1 0 0 is_stmt
0x000000000000002c 5 21 1 0 0
0x0000000000000030 0 21 1 0 0
0x0000000000000034 5 24 1 0 0
0x0000000000000038 5 21 1 0 0
0x0000000000000044 0 21 1 0 0
0x0000000000000048 5 12 1 0 0
0x000000000000004c 0 12 1 0 0
0x0000000000000054 6 24 1 0 0 is_stmt
0x000000000000005c 7 24 1 0 0 is_stmt
0x0000000000000060 8 9 1 0 0 is_stmt
0x0000000000000064 0 9 1 0 0
0x000000000000006c 10 25 1 0 0 is_stmt
0x0000000000000074 11 25 1 0 0 is_stmt
0x0000000000000078 0 0 1 0 0
0x000000000000007c 13 27 1 0 0 is_stmt
0x0000000000000084 13 36 1 0 0
0x0000000000000088 0 0 1 0 0
0x0000000000000090 13 10 1 0 0
0x0000000000000098 14 10 1 0 0 is_stmt
0x00000000000000a8 14 10 1 0 0 is_stmt end_sequence
=================================================================================================
Let’s demonstrate two issue’s that we see w.r.t gdb that are related to
zero line number.
1)As per above line table prologue_end is set to line zero and we set
breakpoint on function then gdb info was stated like below .
(gdb) b main
Breakpoint 1 at 0x800005ec: file test.c, line 0.
It should be, something like
(gdb) b main
Breakpoint 1 at 0x800005ec: file test.c, line 3.
2)
Breakpoint 1, main () at test.c:0
1 /* demo testcase */
(gdb) n
5 if((garr[0] && garr[1])==0){
(gdb)
1 /* demo testcase */
(gdb)
5 if((garr[0] && garr[1])==0){
(gdb)
1 /* demo testcase */
(gdb)
6 garr[0]=1;
(gdb)
7 garr[1]=1;
(gdb)
8 }
(gdb)
1 /* demo testcase */
(gdb)
13 printf("%d %d\n",garr[0], garr[1]);
(gdb)
1 /* demo testcase */
(gdb)
13 printf("%d %d\n",garr[0], garr[1]);
(gdb)
1 1
14 return 0;
(gdb)
Here the sequence like “5->1->5->6” should be “5->5->6” and as per DWARF
standard ,ZERO line has a well-defined meaning and stands for "no source line
corresponds to this location".
>From LLVM point of view the ZERO-LINE debug info added to the compiler
generated remat statement’s like loading global constant /value ,which doesn’t
have “.loc” info from the source.
Also attached assembly file in bug for reference.
Please share your valuable thoughts on this issue’s.
Thanks in Advance,
Jaydeep.
--
You are receiving this mail because:
You are on the CC list for the bug.
next reply other threads:[~2020-08-26 8:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-26 8:07 jaydeepchauhan1494 at gmail dot com [this message]
2020-08-26 15:57 ` [Bug gdb/26538] " jaydeepchauhan1494 at gmail dot com
2020-08-27 2:17 ` simark at simark dot ca
2020-09-03 5:19 ` jaydeepchauhan1494 at gmail dot com
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-26538-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: link
Be 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).