This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/23537] Add step-non-pure command


https://sourceware.org/bugzilla/show_bug.cgi?id=23537

--- Comment #5 from Pedro Alves <palves at redhat dot com> ---
(In reply to Tom Tromey from comment #3)
> (In reply to Pedro Alves from comment #2)
> > anchoring this on "pureness" seems quite odd to me.  A user debugging some
> > code won't normally know off hand if the functions are pure or not?!
> 
> We talked on #gcc today about perhaps using __attribute__((artificial))
> and then having DW_AT_artificial be used for this purpose.
> 
> Another possibility here was to have the artificial flag set up
> some "skip"s by default, then the user could undo them if desired.
> 
> This came up because Johnathan Wakely wanted to make it so that,
> by default, you wouldn't step into std::move.

OK, this rings a bell.  I chatted about that with Jon and Florian a while ago,
and back then I pointed Jon at that "skip" had then been improved to support
regexps (skip -rfunction).  This was almost 2 years ago.  __attribute__
((artificial)) came up too.  Here's the relevant snippet:

<jwakely>       looks like I can use "skip -fu N" for all specializations of a
template, or "skip -rfu ^std::move<.*$" -- awesome
<palves>        there's also "skip -gfile file-glob-pattern", for globbing. 
like maybe, say: "skip -gfile include/c++/*/bits/*" to skip all internal
details.
<jwakely>       for my purposes skipping all internal details is far too much
:)
but std::move and std::forward are just casts to a reference type, so always
skipping them makes sense
<fweimer>       jwakely: Couldn't you add __attribute__ ((artificial)) to their
implementation?
<jwakely>       fweimer: ooh maybe ... never heard of it
<fweimer>       jwakely: glibc does this for its fortify function wrappers.
<jwakely>       fweimer: looks useful!
<jwakely>       doesn't seem to change the behaviour of stepping into them
<jwakely>       or I'm too dumb to use it correctly: move.cc:3:50: warning:
‘__artificial__’ attribute ignored [-Wattributes]

Using attribute artificial irks me somewhat, because I'm not sure marking a
normal function as artificial isn't ... artificial?

An alternative I thought back then that would require no changes to gdb or gcc
was that instead of marking the code, we'd add the "skip -rfu ^std::move<.*$"
to libstdc++'s Python pretty printer stuff, so that users get that by default,
and, users can selectively disable the skipping if they want.  I don't know
whether Jon tried that, but I just kind of assumed he would.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]