public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/15458] New: gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag
@ 2013-05-10 20:43 bogden at arm dot com
  2013-05-10 20:44 ` [Bug gdb/15458] " bogden at arm dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: bogden at arm dot com @ 2013-05-10 20:43 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15458

             Bug #: 15458
           Summary: gdb cannot step into function that begins with first
                    entry in line table, if that entry does not have
                    is_stmt flag
           Product: gdb
           Version: 7.2
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: bogden@arm.com
    Classification: Unclassified


gdb cannot step into function that begins with first entry in line table, if
that entry does not have is_stmt flag set to true - even if subsequent lines of
the function do have is_stmt true. I believe that this such a line table is
legal DWARF.

clang/LLVM can produce such a line table, at least when compiling for ARM
targets.

The attached program exhibits this problem. It was built with a recent trunk
build of LLVM, like this:

clang -target arm step-through.c -integrated-as -g -O0 -c -mcpu=arm7tdmi
-mfloat-abi=soft


So far as I understand it, what is happening is something like:

1) To decide whether to step into a function, gdb looks for a line table entry
associated with an address <= the first address of the function, and the line
table entry associated with the lowest address > the first address of the
function. If it finds such entries, it steps in.
2) The array of line table entries used for this purpose does not include
entries for which is_stmt is not true
3) The first entry in the line table of the attached program refers to a
function 'get_name'. is_stmt is false for this entry, so it is not in gdb's
array.
4) gdb therefore cannot find an entry in the line table that refers to an
address <= get_name.
5) gdb therefore refuses to step into get_name, even though the function
contains a line for which is_stmt is true.

There is another subroutine in the program (func) with a line table entry for
which is_stmt is false. In this case gdb believes it can step in because it
finds an entry referring to an address < address of func.

Some relevant code can be seen at infrun.c:4572 and symtab.c:2031 in
CodeSourcery GCC release arm-2012.03-56-arm-none-eabi. Running --version on
this gdb build gives:
GNU gdb (Sourcery CodeBench Lite 2012.03-56) 7.2.50.20100908-cvs

I realise this build is somewhere between 1 - 3 years behind trunk. I've tried
but failed to find/build a newer gdb with a sim target for ARM.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/15458] gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag
  2013-05-10 20:43 [Bug gdb/15458] New: gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag bogden at arm dot com
@ 2013-05-10 20:44 ` bogden at arm dot com
  2013-05-10 20:45 ` bogden at arm dot com
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bogden at arm dot com @ 2013-05-10 20:44 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15458

--- Comment #1 from Bernard Ogden <bogden at arm dot com> 2013-05-10 20:44:16 UTC ---
Created attachment 7021
  --> http://sourceware.org/bugzilla/attachment.cgi?id=7021
Sample program that demonstrates the problem

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/15458] gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag
  2013-05-10 20:43 [Bug gdb/15458] New: gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag bogden at arm dot com
  2013-05-10 20:44 ` [Bug gdb/15458] " bogden at arm dot com
  2013-05-10 20:45 ` bogden at arm dot com
@ 2013-05-10 20:45 ` bogden at arm dot com
  2013-05-10 20:50 ` bogden at arm dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bogden at arm dot com @ 2013-05-10 20:45 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15458

--- Comment #2 from Bernard Ogden <bogden at arm dot com> 2013-05-10 20:45:00 UTC ---
Created attachment 7022
  --> http://sourceware.org/bugzilla/attachment.cgi?id=7022
Object file with problem .debug_line

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/15458] gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag
  2013-05-10 20:43 [Bug gdb/15458] New: gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag bogden at arm dot com
  2013-05-10 20:44 ` [Bug gdb/15458] " bogden at arm dot com
@ 2013-05-10 20:45 ` bogden at arm dot com
  2013-05-10 20:45 ` bogden at arm dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bogden at arm dot com @ 2013-05-10 20:45 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15458

--- Comment #3 from Bernard Ogden <bogden at arm dot com> 2013-05-10 20:45:21 UTC ---
Created attachment 7023
  --> http://sourceware.org/bugzilla/attachment.cgi?id=7023
Full program with problem .debug_line

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/15458] gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag
  2013-05-10 20:43 [Bug gdb/15458] New: gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag bogden at arm dot com
                   ` (2 preceding siblings ...)
  2013-05-10 20:45 ` bogden at arm dot com
@ 2013-05-10 20:50 ` bogden at arm dot com
  2013-05-11  9:25 ` palves at redhat dot com
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bogden at arm dot com @ 2013-05-10 20:50 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15458

--- Comment #4 from Bernard Ogden <bogden at arm dot com> 2013-05-10 20:50:00 UTC ---
The .axf file was linked from the LLVM-built object like this, using Linaro
GCC's linker:

arm-none-eabi-gcc "-mcpu=arm7tdmi" "-g" "-O0" "-o" "step-through.axf"
step-through.o

arm-none-eabi-gcc --version gives:
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.7.3 20130312
(release) [ARM/embedded-4_7-branch revision 196615])

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/15458] gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag
  2013-05-10 20:43 [Bug gdb/15458] New: gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag bogden at arm dot com
                   ` (3 preceding siblings ...)
  2013-05-10 20:50 ` bogden at arm dot com
@ 2013-05-11  9:25 ` palves at redhat dot com
  2013-05-14  7:18 ` bogden at arm dot com
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: palves at redhat dot com @ 2013-05-11  9:25 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15458

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |palves at redhat dot com

--- Comment #5 from Pedro Alves <palves at redhat dot com> 2013-05-11 09:25:11 UTC ---
> Version: 7.2

Could you please try 7.6 or current mainline?  There were changes in the area
since, made specifically for clang.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/15458] gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag
  2013-05-10 20:43 [Bug gdb/15458] New: gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag bogden at arm dot com
                   ` (4 preceding siblings ...)
  2013-05-11  9:25 ` palves at redhat dot com
@ 2013-05-14  7:18 ` bogden at arm dot com
  2013-05-14  8:43 ` palves at redhat dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bogden at arm dot com @ 2013-05-14  7:18 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15458

--- Comment #6 from Bernard Ogden <bogden at arm dot com> 2013-05-14 07:18:56 UTC ---
Sure, but can you point me at some information on building a gdb with a
simulated target for ARM (i.e. one in which the 'target sim' command works for
ARM)? I haven't yet figured that one out, and I haven't found a prebuilt binary
with it built in that's any more recent than 7.2.

I'll work it out eventually, but I'll be quicker with a little help.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/15458] gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag
  2013-05-10 20:43 [Bug gdb/15458] New: gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag bogden at arm dot com
                   ` (5 preceding siblings ...)
  2013-05-14  7:18 ` bogden at arm dot com
@ 2013-05-14  8:43 ` palves at redhat dot com
  2013-05-14 10:37 ` bogden at arm dot com
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: palves at redhat dot com @ 2013-05-14  8:43 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15458

--- Comment #7 from Pedro Alves <palves at redhat dot com> 2013-05-14 08:43:47 UTC ---
AFAIK, there's nothing special required for building a GDB with a sim, other
than specifying the required --target.  Building GDB with --target=arm-eabi
results in a GDB that supports "target sim" (I just tried that).

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/15458] gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag
  2013-05-10 20:43 [Bug gdb/15458] New: gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag bogden at arm dot com
                   ` (6 preceding siblings ...)
  2013-05-14  8:43 ` palves at redhat dot com
@ 2013-05-14 10:37 ` bogden at arm dot com
  2013-05-14 10:42 ` bogden at arm dot com
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bogden at arm dot com @ 2013-05-14 10:37 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15458

Bernard Ogden <bogden at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|7.2                         |7.6

--- Comment #8 from Bernard Ogden <bogden at arm dot com> 2013-05-14 10:37:56 UTC ---
Thanks. I was just getting the ARM target string wrong.

I see the same behaviour with the 7.6 release. I configured it like this:

./configure --target arm-eabi --enable-sim

and --version says:

GNU gdb (GDB) 7.6
<snip>
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-eabi".

I've updated the Version field.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/15458] gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag
  2013-05-10 20:43 [Bug gdb/15458] New: gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag bogden at arm dot com
                   ` (7 preceding siblings ...)
  2013-05-14 10:37 ` bogden at arm dot com
@ 2013-05-14 10:42 ` bogden at arm dot com
  2013-05-14 10:43 ` bogden at arm dot com
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bogden at arm dot com @ 2013-05-14 10:42 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15458

Bernard Ogden <bogden at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #7022|0                           |1
        is obsolete|                            |

--- Comment #9 from Bernard Ogden <bogden at arm dot com> 2013-05-14 10:42:02 UTC ---
Created attachment 7025
  --> http://sourceware.org/bugzilla/attachment.cgi?id=7025
Corrected object with relevant .debug_line

Forgot to regenerate the .o and .axf after adding a Copyright statement to the
source. Therefore uploading new .o (and .axf in a moment).

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/15458] gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag
  2013-05-10 20:43 [Bug gdb/15458] New: gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag bogden at arm dot com
                   ` (8 preceding siblings ...)
  2013-05-14 10:42 ` bogden at arm dot com
@ 2013-05-14 10:43 ` bogden at arm dot com
  2013-05-14 10:46 ` palves at redhat dot com
  2013-05-16 15:11 ` davidbalbert at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: bogden at arm dot com @ 2013-05-14 10:43 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15458

Bernard Ogden <bogden at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #7023|0                           |1
        is obsolete|                            |

--- Comment #10 from Bernard Ogden <bogden at arm dot com> 2013-05-14 10:43:18 UTC ---
Created attachment 7026
  --> http://sourceware.org/bugzilla/attachment.cgi?id=7026
Corrected full program with problem .debug_line

Updated .axf built from source with the copyright comment. This makes debugging
much less painful.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/15458] gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag
  2013-05-10 20:43 [Bug gdb/15458] New: gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag bogden at arm dot com
                   ` (9 preceding siblings ...)
  2013-05-14 10:43 ` bogden at arm dot com
@ 2013-05-14 10:46 ` palves at redhat dot com
  2013-05-16 15:11 ` davidbalbert at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: palves at redhat dot com @ 2013-05-14 10:46 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15458

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/15458] gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag
  2013-05-10 20:43 [Bug gdb/15458] New: gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag bogden at arm dot com
                   ` (10 preceding siblings ...)
  2013-05-14 10:46 ` palves at redhat dot com
@ 2013-05-16 15:11 ` davidbalbert at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: davidbalbert at gmail dot com @ 2013-05-16 15:11 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15458

David Albert <davidbalbert at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |davidbalbert at gmail dot
                   |                            |com

--- Comment #11 from David Albert <davidbalbert at gmail dot com> 2013-05-16 15:11:28 UTC ---
I don't know quite enough about DWARF to know for sure, but it seems that this
might be related to bug 14870. I tried to dive in a bit deeper when I first
reported it, but I didn't have the requisite knowledge and wasn't able to make
much progress.

I'd be happy and try to reproduce this bug, but it's not clear to me what the
steps to reproduce are other than compiling gdb with arm-eabi as the target.

FWIW, I just tested bug 14870 with gdb 7.6 and Apple Clang 4.2 (LLVM 3.2), and
I'm still able to reproduce it. If these are indeed related, I'd love to see
them fixed. Please let me know if there's any way I can be helpful.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-05-16 15:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-10 20:43 [Bug gdb/15458] New: gdb cannot step into function that begins with first entry in line table, if that entry does not have is_stmt flag bogden at arm dot com
2013-05-10 20:44 ` [Bug gdb/15458] " bogden at arm dot com
2013-05-10 20:45 ` bogden at arm dot com
2013-05-10 20:45 ` bogden at arm dot com
2013-05-10 20:50 ` bogden at arm dot com
2013-05-11  9:25 ` palves at redhat dot com
2013-05-14  7:18 ` bogden at arm dot com
2013-05-14  8:43 ` palves at redhat dot com
2013-05-14 10:37 ` bogden at arm dot com
2013-05-14 10:42 ` bogden at arm dot com
2013-05-14 10:43 ` bogden at arm dot com
2013-05-14 10:46 ` palves at redhat dot com
2013-05-16 15:11 ` davidbalbert at gmail dot com

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).