On Пт, ноя 15, 2019 at 00:17, Konstantin Kharlamov <hi-an...@yandex.ru> wrote:
On 14.11.2019 23:50, Segher Boessenkool wrote:
Hi!

On Thu, Nov 14, 2019 at 07:01:47PM +0300, Konstantin Kharlamov wrote:
Generally, people expect functions to accept arguments directly. But
ones defined in gdbinit did not use the argument, which may be confusing for newcomers. But we can't change behavior to use the argument without breaking existing users of the gdbinit. Let's fix this by adding a check
for whether a user passed an argument, and either use it or go with
older behavior.

2019-11-14  Konstantin Kharlamov  <hi-an...@yandex.ru>

* gdbinit.in (pp, pr, prl, pt, pct, pgg, pgq, pgs, pge, pmz, ptc, pdn, ptn, pdd, prc, pi, pbm, pel, trt): Make use of $arg0 if a user passed it

(Lines in a changelog end in a dot).

I love this... if it works :-) How was it tested? With what GDB versions?

I ran GCC under GDB, and set a breakpoint somewhere in the GCC code where `stmt` variable is defined (I don't remember the type, ATM I'm from another PC). Then I tested 3 things:

1. that `pgg stmt` prints the `stmt` content
2. that `p 0` followed by `pgg` prints nothing (because the underlying function checks its argument for being zero)
3. that `p 1` followed by `pgg` crashes.

Tested on Archlinux, gdb version is 8.3.1

Ok, I looked in the office: `stmt` has type `gimple`.

And just in case it matters: I didn't edit the code manually, instead the modifications were done with a find&replace functional in Emacs.


Reply via email to