public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH v2 2/2] gdb/dwarf2: fix "info locals" for clang-compiled inlined functions
Date: Wed, 14 Apr 2021 09:30:00 -0400	[thread overview]
Message-ID: <3ee31fb1-58b0-570f-1dc3-da4b8fc2254b@polymtl.ca> (raw)
In-Reply-To: <2df47e628397c8624bf2d790141c8434901de8aa.1618387702.git.tankut.baris.aktemur@intel.com>

On 2021-04-14 4:14 a.m., Tankut Baris Aktemur wrote:
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-with-lexical-scope.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-with-lexical-scope.exp
> new file mode 100644
> index 00000000000..e815c859639
> --- /dev/null
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-with-lexical-scope.exp
> @@ -0,0 +1,137 @@
> +# Copyright 2021 Free Software Foundation, Inc.
> +
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 3 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +
> +# Test that scoped local variables in an inlined function are printed
> +# properly.
> +
> +load_lib dwarf.exp
> +
> +# This test can only be run on targets that support DWARF-2 and use
> +# gas.
> +if {![dwarf2_support]} {
> +    return 0
> +}
> +
> +standard_testfile .c .S
> +
> +# Make some DWARF for the test.  The concrete inlined instance
> +# (i.e. the DW_TAG_inlined_subroutine) has a DW_TAG_lexical_block that
> +# does not contain a DW_AT_abstract_origin attribute.  This is
> +# deliberate.  Bad GDB printed duplicate local variables with
> +# "optimized out" values in this case.
> +
> +set asm_file [standard_output_file $srcfile2]
> +Dwarf::assemble $asm_file {
> +    global srcfile srcdir subdir
> +    declare_labels int_label func_label num_label value_label lines_label
> +
> +    get_func_info main
> +    set func_call [gdb_get_line_number "func call"]
> +
> +    cu {} {
> +	compile_unit {
> +	    {language @DW_LANG_C99}
> +	    {name $srcfile}
> +	    {low_pc $main_start addr}
> +	    {high_pc "$main_start + $main_len" addr}
> +	    {stmt_list ${lines_label} DW_FORM_sec_offset}
> +	} {
> +	    int_label: base_type {
> +                {name "int"}
> +                {byte_size 4 sdata}
> +		{encoding @DW_ATE_signed}
> +            }
> +
> +	    func_label: subprogram {
> +		{name func}
> +		{inline 3 data1}

You could maybe use

  {inline @DW_INL_declared_inlined}

here.  The form will be sdata instead of data1, but I don't think that's
a problem.

Otherwise, LGTM, thanks!

Simon

  parent reply	other threads:[~2021-04-14 13:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14  8:14 [PATCH v2 0/2] " Tankut Baris Aktemur
2021-04-14  8:14 ` [PATCH v2 1/2] testsuite, gdb: recognize DW_OP_fbreg in lib/dwarf.exp Tankut Baris Aktemur
2021-04-14  9:50   ` Andrew Burgess
2021-04-14  8:14 ` [PATCH v2 2/2] gdb/dwarf2: fix "info locals" for clang-compiled inlined functions Tankut Baris Aktemur
2021-04-14 12:18   ` Aktemur, Tankut Baris
2021-04-14 15:46     ` Andrew Burgess
2021-04-14 17:00       ` Aktemur, Tankut Baris
2021-04-14 13:30   ` Simon Marchi [this message]
2021-04-14 17:08     ` Aktemur, Tankut Baris

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=3ee31fb1-58b0-570f-1dc3-da4b8fc2254b@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tankut.baris.aktemur@intel.com \
    /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).