From: John Baldwin <jhb@FreeBSD.org>
To: svante.signell@gmail.com, Tom Tromey <tom@tromey.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>,
Simon Marchi <simark@simark.ca>,
gdb-patches@sourceware.org
Subject: Re: [PATCH] Please define thread_info as struct thread_info (and other stuff)
Date: Mon, 17 Dec 2018 21:41:00 -0000 [thread overview]
Message-ID: <430466fb-3706-da11-39dc-28c0b342041c@FreeBSD.org> (raw)
In-Reply-To: <aa49192a4651ab71fc092f02af9bd4968eabfaca.camel@gmail.com>
On 12/17/18 12:51 PM, Svante Signell wrote:
> On Sun, 2018-12-16 at 16:10 -0700, Tom Tromey wrote:
>>>>>>> "Svante" == Svante Signell <svante.signell@gmail.com> writes:
>> Svante> Another issue is to compile C-code (and C++-code) in *.c files.
>> Svante> Please rename these to *.cpp (and eventually the header files to
>> *.hpp)! As it is now it is very confusing.
>>
>> I think this was discussed When we made this switch, and the conclusion
>> was that a mass rename would be worse.
>
> Do you really need to compile all files with a C++ compiler? Pure C-code could
> still be compiled with a C compiler.
GDB isn't written in C anymore. target_ops is a class with virtual methods,
the use of gdb::unique_ptr<> (basically std::unique_ptr<>) is rather
ubiquitous now, etc. In fact, I think we even require C++11 and not just
C++03.
>> Svante> Finally, I've found the problem (but no workaround yet): thread_info
>> is an RPC on GNU/Hurd, and including mach.h in gdb/config/i386/nm-
>> i386gnu.h:#include <mach.h> further includes <mach/mach_interface.h> which has
>> the conflicting name Svante> of that RPC: kern_return_t thread_info
>>
>> Typical answers for this kind of thing are either to segregate the use
>> of the system header somehow, or maybe namespacing or some other kind of
>> renaming. I haven't looked into the details much in this case I'm
>> afraid.
>
> As I see it you need to:
>
> 1) Apply the patches submitted earlier in this thread using struct thread_info
> consistently everywhere (simplest).
> 2) Rename all usage of the struct thread_info to something else e.g. struct
> gdb_thread_info (not future-proof though).
> 3) Create a gdb namespace for all your code to avoid conflicts.
> 4) Segregate the use of system header files as you write above. Dunno how to do
> that though, but some of you should.
Normally code for native targets do 4). I've had to be careful about which
includes I use in native FreeBSD targets to avoid namespace collisions, etc.
3) might not be a terrible idea eventually, but you'd have to make it explict
and avoid using 'using namespace gdb' for it to actually be useful.
--
John Baldwin
                                                                           Â
next prev parent reply other threads:[~2018-12-17 21:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-15 19:36 Svante Signell
2018-12-15 22:48 ` Tom Tromey
2018-12-15 23:01 ` Svante Signell
2018-12-16 4:31 ` Simon Marchi
2018-12-16 5:14 ` Svante Signell
2018-12-16 6:02 ` Simon Marchi
2018-12-16 16:22 ` Tom Tromey
2018-12-16 9:20 ` Andreas Schwab
2018-12-16 19:08 ` Svante Signell
2018-12-16 23:10 ` Tom Tromey
2018-12-17 20:51 ` Svante Signell
2018-12-17 21:41 ` John Baldwin [this message]
2019-02-14 15:16 ` Thomas Schwinge
2018-12-20 13:31 ` Svante Signell
2018-12-20 22:34 ` Tom Tromey
2018-12-20 23:26 ` Simon Marchi
2018-12-24 21:51 ` Tom Tromey
2019-01-12 18:37 ` Svante Signell
2019-01-12 20:50 ` Tom Tromey
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=430466fb-3706-da11-39dc-28c0b342041c@FreeBSD.org \
--to=jhb@freebsd.org \
--cc=gdb-patches@sourceware.org \
--cc=schwab@linux-m68k.org \
--cc=simark@simark.ca \
--cc=svante.signell@gmail.com \
--cc=tom@tromey.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