Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: Tom Tromey <tromey@redhat.com>,
	gdb-patches@sourceware.org,
	       Sergio Durigan Junior <sergiodj@redhat.com>
Subject: Re: [PATCH 2/6] Introduce `pre_expanded sals'
Date: Wed, 27 Apr 2011 18:02:00 -0000	[thread overview]
Message-ID: <20110427180124.GA3466@host1.jankratochvil.net> (raw)
In-Reply-To: <201104181938.28644.pedro@codesourcery.com>

On Mon, 18 Apr 2011 20:38:28 +0200, Pedro Alves wrote:
> (ignoring that frontends aren't prepared to have a 
> breakpoint map to more than one source file:line)

I do not address this part in this mail, I do not know much about it.


> Now, do "break A::A".
[...]
>  (gdb) info breakpoints 
>  Num     Type           Disp Enb Address            What
>  1       breakpoint     keep y   <MULTIPLE>         
>  1.1                         y     0x00000000004005d2 in A::A() at foo.cc:33
>  1.2                         y     0x00000000004005ec in A::A() at foo.cc:33
>  1.3                         y     0x00000000004005d2 in A::A(int) at foo.cc:38
>  1.4                         y     0x00000000004005ec in A::A(int) at foo.cc:38
> 
> Now, say I didn't want to A::A(int) overload to break afterall.

If I want to deal with `A::A()' and `A::A(int)' separately I will never type
`break A::A' in the first place but create `break A::A()' and `break A::A(int)'
as two separate breakpoints (or just one of them).


> This is why I proposed in the response to Jan, that if we want
> to group different "_source_ locations" under the same breakpoint,
> we implement it as a 3rd hierarchy, so you'd get:

I agree 3-level hierarchy is the best but I do not think it is practically
worth it, it again creates a feature no normal user is going to use.


> You do "break inline_func".  There are two overloads, so the

While offtopic in general breakpoint on inlined functions do not yet work:
	[Bug breakpoints/10738] Cannot set breakpoint on inlined function


>  (gdb) info breakpoints 
>  Num     Type           Disp Enb Address            What
>  1       breakpoint     keep y   <MULTIPLE>         
>  1.1                         y     "program:name" in foo_func() at blah.c:12
>  1.2                         n     "program:name" in bar_func() at blah.c:20
>  1.3                         y     "program:name" in qux_func() at blah.c:45
> 
> If the program changes, say the 1.2 location disappears, you've now
> confused GDB --- how will it know that 1.3 is supposed to be enabled,
> given that it is now the second location?  (multiple variations of
> this issue).

Besides unspecifically broken reread_symbols during program change normally
update_breakpoint_locations on any nontrivial C++ code finds
HAVE_AMBIGUOUS_NAMES true, uses breakpoint_locations_match and as if the
program really has changed any way the addresses will not match and specific
bp_location enabled-flag will get reset back to enabled anyway.

It also happens with any PIE program but that is more my fault (as its fix in
Fedora is too ugly to be even submitted).


> > I hit this while debugging gdb itself from time to time -- try `break
> > parse_number' and guess where it gets set.
> 
> It's not necessarily a bad thing (and not necessarily a good thing
> either).   If you have a big project, with a bunch of static
> "foo" functions, it's not unreasonable to have "b foo"
> break at the "closest" function with that name in your context.

The problem with GDB is IMO that "your context" is very random, user may not
be much aware there is any context, with the debuggee stopping here and there.


> What would "list parse_number" do if "break parse_number" breaks
> in all the instances of that static function?

A good point, it should error, it needs more specific input.


Thanks,
Jan


  reply	other threads:[~2011-04-27 18:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-04  3:08 Sergio Durigan Junior
2011-04-06 20:13 ` Tom Tromey
2011-04-12 11:18   ` Pedro Alves
2011-04-12 11:53     ` Jan Kratochvil
2011-04-12 13:30       ` Pedro Alves
2011-04-12 20:34         ` Tom Tromey
2011-04-12 22:22         ` Matt Rice
2011-04-13  9:53           ` Eli Zaretskii
2011-07-27 17:08         ` Tom Tromey
2011-07-29 20:36           ` Sergio Durigan Junior
2011-08-04 20:41             ` Tom Tromey
2011-08-05  3:41               ` Sergio Durigan Junior
2011-08-05 14:40                 ` Tom Tromey
2011-08-05 18:06                   ` Sergio Durigan Junior
2011-08-10 14:24           ` Tom Tromey
2011-05-03 16:09       ` Jerome Guitton
2011-05-03 18:17         ` Joel Brobecker
2011-04-12 20:26     ` Tom Tromey
2011-04-13  9:51       ` Eli Zaretskii
2011-04-13 19:20         ` Tom Tromey
2011-04-15 10:37           ` Eli Zaretskii
2011-04-18 18:37       ` Pedro Alves
2011-04-27 18:02         ` Jan Kratochvil [this message]
2011-04-29 20:42         ` Tom Tromey
2011-04-11 21:08 ` Jan Kratochvil

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=20110427180124.GA3466@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    --cc=sergiodj@redhat.com \
    --cc=tromey@redhat.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