Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Weimin Pan <weimin.pan@oracle.com>,
	gdb-patches@sourceware.org,
	Simon Marchi <simon.marchi@polymtl.ca>
Subject: Re: [PATCH v3] gdb: CTF support
Date: Mon, 07 Oct 2019 09:44:00 -0000	[thread overview]
Message-ID: <fe8385b6-cb00-415d-93b4-898f5d29342d@suse.de> (raw)
In-Reply-To: <596e6b5b-901b-b1ad-fb9a-3a6631f44547@suse.de>

On 07-10-19 11:33, Tom de Vries wrote:
> On 04-10-19 00:56, Weimin Pan wrote:
>> +/* The routines that read and process fields/members of a C struct, union,
>> +   or enumeration, pass lists of data member fields in an instance of a
>> +   field_info structure. It is derived from dwarf2read.c.  */
>> +
>> +struct nextfield
>> +{
>> +  struct field field {};
>> +};
>> +
>> +struct field_info
> 
> Hi,
> 
> not only is field_info derived from dwarf2read.c, it uses the same name
> for the type.  This is a C++ One-Definition-Rule violation, which causes
> most of the test-suite to start failing for me.
> 
> What happens is that here:
> ...
>   if (die->child != NULL && ! die_is_declaration (die, cu))
>     {
>       struct field_info fi;
>       std::vector<struct symbol *> template_args;
> ...
> the constructor for field_info is called, but it calls the constructor
> for field_info defined in ctfread.c rather than dwarf2read.c.

I was curious if I could detect this at build time, and indeed after
building with -fuse-ld=gold -Wl,--detect-odr-violations, I get:
....
$ grep -i 'odr violation' build/MAKELOG
/usr/bin/ld.gold: warning: while linking gdb: symbol
'field_info::field_info()' defined in multiple places (possible ODR
violation):
/usr/bin/ld.gold: warning: while linking gdb: symbol
'field_info::field_info()' defined in multiple places (possible ODR
violation):
/usr/bin/ld.gold: warning: while linking gdb: symbol
'field_info::~field_info()' defined in multiple places (possible ODR
violation):
/usr/bin/ld.gold: warning: while linking gdb: symbol
'field_info::~field_info()' defined in multiple places (possible ODR
violation):
...

Thanks,
- Tom


  reply	other threads:[~2019-10-07  9:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03 22:58 Weimin Pan
2019-10-04  1:11 ` Simon Marchi
2019-10-04 21:29   ` Weimin Pan
2019-10-07  9:33 ` Tom de Vries
2019-10-07  9:44   ` Tom de Vries [this message]
2019-10-07 12:07   ` Andrew Burgess
2019-10-07 14:58     ` Simon Marchi
2019-10-07 16:08     ` Wei-min Pan

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=fe8385b6-cb00-415d-93b4-898f5d29342d@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --cc=weimin.pan@oracle.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