public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "bogden at arm dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [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
Date: Fri, 10 May 2013 20:43:00 -0000	[thread overview]
Message-ID: <bug-15458-4717@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2013-05-10 20:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-10 20:43 bogden at arm dot com [this message]
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

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