Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH v1.1 1/3] Introduce gdb::function_view
Date: Thu, 23 Feb 2017 14:49:00 -0000	[thread overview]
Message-ID: <dbc56fcb-871b-72c0-755f-e741fa87162f@redhat.com> (raw)
In-Reply-To: <20170222221158.hqfnyyvyqqxetygk@localhost>

On 02/22/2017 10:11 PM, Yao Qi wrote:

> Double "a" at the end.

> 
> Double "while"s.

Thanks, fixed.

> 
>> +namespace gdb {
>> +
> 
> This is a new namespace in gdb source.  What is the rule of using this
> namespace?

I don't have a hard rule predetermined.  I originally put the C++03
unique_ptr shim under the gdb namespace to make it clear at the
call sites that that was not the std type, but gdb's replacement.
I.e., gdb::unique_ptr vs std::unique_ptr.  Since then, gdb::unique_ptr is
gone, but gdb::unique_xmalloc_ptr remains, and we've been putting
these generic library-like utilities under the namespace:

 common/function-view.h:154:namespace gdb {
 common/function-view.h:353:} /* namespace gdb */
 common/gdb_unlinker.h:23:namespace gdb
 common/gdb_unique_ptr.h:25:namespace gdb
 common/gdb_unique_ptr.h:43:} /* namespace gdb */
 common/gdb_optional.h:23:namespace gdb
 common/gdb_ref_ptr.h:25:namespace gdb

I think putting these new things in _some_ namespace is the
right thing to do.  gdb is just the no-brainer namespace name.

IMO, _all_ of GDB should be under "namespace gdb".  Then these utilities
would either be put in "namespace gdb" too, or in a "namespace gtl",
for "gdb template library" or something like that.  Or we could
put them under "gtl" already.

I have a series that put the whole of gdb under namespace gdb:
 https://github.com/palves/gdb/commits/palves/cxx-gdb-namespace

I wrote that while experimenting with ways to use
gnulib's C++ namespace mode, in order to avoid the 
"#define open rpl_open" defines gnulib does...  I nowadays
believe the put-gdb-in-a-namespace approach is the best one.

However, when we put gdb under a namespace, debugging GDB itself
becomes a bit harder, since you then have to do "b gdb::some_function"
instead of "b some_function".  This is just dogfooding pain,
of course, users run into this too...

That's what led to me to work on this branch:

 https://github.com/palves/gdb/commits/palves/cp-linespec-2

with that, "b some_function" sets breakpoints on all
functions/methods named some_function in all namespaces.

And it was testing that branch with --target_board=dwarf4-gdb-index
that led to the bug fixed by this series...  It's a never
ending story... :-)

Thanks,
Pedro Alves


  reply	other threads:[~2017-02-23 14:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-22 14:50 [PATCH 0/3] Introduce gdb::function_view & fix completion bug Pedro Alves
2017-02-22 14:50 ` [PATCH 1/3] Introduce gdb::function_view Pedro Alves
2017-02-22 15:15   ` Simon Marchi
2017-02-22 17:40     ` Pedro Alves
2017-02-22 17:49       ` [PATCH v1.1 " Pedro Alves
2017-02-22 22:12         ` Yao Qi
2017-02-23 14:49           ` Pedro Alves [this message]
2017-02-23 15:11             ` Yao Qi
2017-02-23 15:20               ` Pedro Alves
2017-02-23 15:34                 ` Yao Qi
2017-02-22 22:23         ` Yao Qi
2017-02-23 14:50           ` [PATCH v1.2 " Pedro Alves
2017-02-23 14:58             ` Yao Qi
2017-02-23 14:59               ` Pedro Alves
2017-02-22 18:02       ` [PATCH " Simon Marchi
2017-02-22 14:50 ` [PATCH 3/3] Fix gdb.base/completion.exp with --target_board=dwarf4-gdb-index Pedro Alves
2017-02-23 16:02   ` Yao Qi
2017-02-23 17:12     ` Pedro Alves
2017-02-23 17:24     ` [PATCH v2 0/2] " Pedro Alves
2017-02-23 17:24       ` [PATCH v2 2/2] " Pedro Alves
2017-02-24 15:34         ` Yao Qi
2017-02-24 17:15           ` Pedro Alves
2017-02-23 17:24       ` [PATCH v2 1/2] symtab.c: Small refactor Pedro Alves
2017-02-23 21:45         ` Yao Qi
2017-02-24 17:45           ` Pedro Alves
2017-02-22 14:50 ` [PATCH 2/3] Use gdb::function_view in iterate_over_symtabs & co Pedro Alves
2017-02-22 22:40   ` Yao Qi

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=dbc56fcb-871b-72c0-755f-e741fa87162f@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    --cc=simon.marchi@polymtl.ca \
    /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