From: Tom Tromey <tom@tromey.com>
To: "Natarajan, Kavitha via Gdb-patches" <gdb-patches@sourceware.org>
Cc: Bruno Larsen <blarsen@redhat.com>,
"Natarajan, Kavitha" <Kavitha.Natarajan@amd.com>,
"George, Jini Susan" <JiniSusan.George@amd.com>,
"Parasuraman, Hariharan" <Hariharan.Parasuraman@amd.com>
Subject: Re: [PATCH] Debug support for global alias variable
Date: Fri, 15 Apr 2022 10:06:06 -0600 [thread overview]
Message-ID: <87ilra1gcx.fsf@tromey.com> (raw)
In-Reply-To: <DM4PR12MB57969D23A55E9423C120064AF71F9@DM4PR12MB5796.namprd12.prod.outlook.com> (Kavitha via Gdb-patches Natarajan's message of "Wed, 30 Mar 2022 12:25:54 +0000")
>>>>> Natarajan, Kavitha via Gdb-patches <gdb-patches@sourceware.org> writes:
> When clang emits the dwarf information of global alias variable
> as DW_TAG_imported_declaration, gdb does not handle it. GDB reads
> this tag as C++/fortran imported declaration (type alias, namespace
> alias and fortran module). Added support to handle this tag as
> alias variable.
Thank you for the patch.
> + if (((cu->per_cu->lang == language_c)
> + || (cu->per_cu->lang == language_cplus))
This expression is over-parenthesized.
The inner parens can be removed.
However, I don't understand why this would necessarily be specific to C
or C++. The old read_namespace_alias wasn't, so doesn't this check
possibly regress for some other language?
> +#define MAX_NESTED_IMPORTED_DECLARATIONS 100
There doesn't seem to be a need to move this.
> /* If the compiler has nested DW_AT_imported_declaration DIEs,
> - keep inspecting DIEs until we hit the underlying import. */
> -#define MAX_NESTED_IMPORTED_DECLARATIONS 100
> + keep inspecting DIEs until we hit the underlying import. */
This is an unnecessary change to the indentation.
I think gdb uses tabs, so it's also incorrect.
> for (num = 0; num < MAX_NESTED_IMPORTED_DECLARATIONS; ++num)
> {
> attr = dwarf2_attr (d, DW_AT_import, cu);
> if (attr == NULL)
> - break;
> + return false;
This change doesn't seem to be needed.
> + /* This declaration is a global variable alias. Add
> + a symbol for it whose type is same as aliased variable. */
> + type = die_type (d, imported_cu);
> + struct symbol *sym = new_symbol (die, type, cu);
> + attr = dwarf2_attr (d, DW_AT_location, imported_cu);
> + sym->set_aclass_index (LOC_UNRESOLVED);
> + if (attr != nullptr)
> + {
> + var_decode_location (attr, sym, cu);
> + }
This is over-braced.
> + /* Reset the flag as it is not a namespace alias. */
> + cu->processing_has_namespace_info = false;
This variable is super weird. Once it is set to true, it is never
changed back. In fact, setting it to false here probably will introduce
bugs.
I wonder if processing_has_namespace_info can just be removed. cu.h
makes it sound extremely obsolete:
/* When true, the file that we're processing is known to have
debugging info for C++ namespaces. GCC 3.3.x did not produce
this information, but later versions do. */
Anyway, I think you should just remove this line and the comment
referring to it.
Tom
next prev parent reply other threads:[~2022-04-15 16:06 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-04 13:44 Natarajan, Kavitha
2022-03-14 11:15 ` Natarajan, Kavitha
2022-03-24 6:36 ` Natarajan, Kavitha
2022-03-24 13:53 ` Bruno Larsen
2022-03-28 15:14 ` Natarajan, Kavitha
2022-03-29 14:02 ` Bruno Larsen
2022-03-30 11:30 ` Natarajan, Kavitha
2022-03-30 12:25 ` Natarajan, Kavitha
2022-04-05 6:26 ` Natarajan, Kavitha
2022-04-05 13:33 ` Bruno Larsen
2022-04-05 14:02 ` Natarajan, Kavitha
2022-04-12 8:38 ` Natarajan, Kavitha
2022-04-15 16:06 ` Tom Tromey [this message]
2022-04-18 11:04 ` Natarajan, Kavitha
2022-04-18 15:03 ` Tom Tromey
2022-04-19 12:45 ` Natarajan, Kavitha
2022-04-19 22:59 ` Tom Tromey
2022-04-20 6:00 ` Natarajan, Kavitha
2022-04-20 10:33 ` Pedro Alves
2022-04-20 12:17 ` Natarajan, Kavitha
2022-04-25 13:10 ` Natarajan, Kavitha
2022-05-05 9:53 ` Natarajan, Kavitha
2022-06-07 9:08 ` Natarajan, Kavitha
2022-06-08 16:29 ` Pedro Alves
2022-06-09 11:36 ` Pedro Alves
2022-06-13 11:11 ` Natarajan, Kavitha
2022-06-13 13:54 ` Pedro Alves
2022-06-13 17:28 ` Natarajan, Kavitha
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=87ilra1gcx.fsf@tromey.com \
--to=tom@tromey.com \
--cc=Hariharan.Parasuraman@amd.com \
--cc=JiniSusan.George@amd.com \
--cc=Kavitha.Natarajan@amd.com \
--cc=blarsen@redhat.com \
--cc=gdb-patches@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).