public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: sergiodj+buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Fix breakpoint add on inlined function using function name.
Date: Tue, 09 Jan 2018 10:03:00 -0000	[thread overview]
Message-ID: <b1dc1806fad00fc5b2589164e964646c02a700fa@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT b1dc1806fad00fc5b2589164e964646c02a700fa ***

Author: Xavier Roirand <roirand@adacore.com>
Branch: master
Commit: b1dc1806fad00fc5b2589164e964646c02a700fa

Fix breakpoint add on inlined function using function name.

Using this Ada example:

  package B is
    procedure Read_Small with Inline_Always;
  end B;

  package body B is
    Total : Natural := 0;
    procedure Read_Small is
    begin
      Total := Total + 1;
    end Read_Small;
  end B;

and

  with B;

  procedure M is
  begin
    B.Read_Small;
  end M;

% gnatmake -g -O0 -m m.adb -cargs -gnatn
% gdb m

Inserting a breakpoint on Read_Small inlined function does not work:

(gdb) b read_small
Breakpoint 1 at 0x40250e: file b.adb, line 5.
(gdb) info b
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x000000000040250e in b.doit at b.adb:5
(gdb)

In this exemple we should have two breakpoints set, one in package B and
the other one in the inlined instance inside procedure M), like below:

(gdb) b read_small
Breakpoint 1 at 0x40250e: b.adb:5. (2 locations)
(gdb) info b
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   <MULTIPLE>
1.1                         y     0x000000000040250e in b.doit at b.adb:5
1.2                         y     0x0000000000402540 in m at b.adb:5
(gdb)

Looking at the DWARF info for inlined instance of Read_Small:

<1><1526>: Abbrev Number: 2 (DW_TAG_subprogram)
    <1527>   DW_AT_name        : ([...], offset: 0x1e82): b__read_small
    <152b>   DW_AT_decl_file   : 2
    <152c>   DW_AT_decl_line   : 3
    <152d>   DW_AT_inline      : 3      (declared as inline and inlined)
[...]
 <2><1547>: Abbrev Number: 4 (DW_TAG_inlined_subroutine)
    <1548>   DW_AT_abstract_origin: <0x1526>
    <154c>   DW_AT_low_pc      : 0x402552
    <1554>   DW_AT_high_pc     : 0x2b
    <155c>   DW_AT_call_file   : 1
    <155d>   DW_AT_call_line   : 5
 <2><155e>: Abbrev Number: 0

During the parsing of DWARF info in order to produce partial DIE linked
list, the DW_TAG_inlined_subroutine were skipped thus not present in the
final partial dies.
Taking DW_TAG_inlined_subroutine in account during the parsing process
fixes the problem.

gdb/ChangeLog:

        * dwarf2read.c (scan_partial_symbols, add_partial_symbol)
        (add_partial_subprogram, load_partial_dies): Add
        DW_TAG_inlined_subroutine handling.

gdb/testsuite/ChangeLog:

        * gdb.ada/bp_inlined_func: New testcase.


             reply	other threads:[~2018-01-09 10:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-09 10:03 sergiodj+buildbot [this message]
2018-01-09 10:03 ` Failures on Fedora-x86_64-m64, branch master sergiodj+buildbot
2018-01-09 10:07 ` Failures on Fedora-i686, " sergiodj+buildbot
2018-01-09 10:09 ` Failures on Fedora-x86_64-native-gdbserver-m32, " sergiodj+buildbot
2018-01-09 10:12 ` Failures on Fedora-x86_64-m32, " sergiodj+buildbot
2018-01-09 10:24 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " sergiodj+buildbot
2018-01-09 10:26 ` Failures on Fedora-x86_64-cc-with-index, " sergiodj+buildbot
2018-01-09 10:32 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " sergiodj+buildbot
2018-01-09 10:34 ` Failures on Fedora-x86_64-native-gdbserver-m64, " sergiodj+buildbot
2018-01-09 11:00 ` Failures on Ubuntu-AArch64-native-gdbserver-m64, " sergiodj+buildbot
2018-01-09 13:12 ` Failures on Ubuntu-AArch32-native-extended-gdbserver-m32, " sergiodj+buildbot
2018-01-09 14:17 ` Failures on Ubuntu-AArch32-m32, " sergiodj+buildbot

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=b1dc1806fad00fc5b2589164e964646c02a700fa@gdb-build \
    --to=sergiodj+buildbot@sergiodj.net \
    --cc=gdb-testers@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).