[PATCH v3] gdbinit.in: allow to pass function argument explicitly

2019-11-14 Thread Konstantin Kharlamov
a user passed an argument, and either use it or go with older behavior. 2019-11-14 Konstantin Kharlamov * 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 --- v3: use the way to detect

Re: [PATCH v2 2/2] gdbinit.in: allow to pass function argument explicitly

2019-11-14 Thread Konstantin Kharlamov
On Чт, ноя 14, 2019 at 16:57, Alexander Monakov wrote: On Thu, 14 Nov 2019, Konstantin Kharlamov wrote: Though, this wouldn't be equivalent to what new people, who just want to call `debug()` with the arg, would expect :) If you want to deduplicate the function call, I can reorganize

Re: [PATCH v2 2/2] gdbinit.in: allow to pass function argument explicitly

2019-11-14 Thread Konstantin Kharlamov
On Чт, ноя 14, 2019 at 18:00, Alexander Monakov wrote: On Thu, 14 Nov 2019, Alexander Monakov wrote: On Thu, 14 Nov 2019, Konstantin Kharlamov wrote: > I also named `dbgarg` as `debug_arg` because I figured I confuse whether it > was `gdbarg` or `gdbarg` :D It should

Re: [PATCH v2 2/2] gdbinit.in: allow to pass function argument explicitly

2019-11-14 Thread Konstantin Kharlamov
On Чт, ноя 14, 2019 at 16:13, Alexander Monakov wrote: On Thu, 14 Nov 2019, Konstantin Kharlamov wrote: Thanks! Unfortunately AFAIK ternary expressions are broken in gdb https://sourceware.org/bugzilla/show_bug.cgi?id=22466 :c Indeed, I didn't notice that. But it still would be nice

Re: [PATCH 2/2] gdbinit.in: fix wrong reference to function argument

2019-11-13 Thread Konstantin Kharlamov
On Ср, ноя 13, 2019 at 15:23, Jason Merrill wrote: On Wed, Nov 13, 2019 at 6:39 AM Segher Boessenkool wrote: On Tue, Nov 12, 2019 at 04:17:17PM +0300, Konstantin Kharlamov wrote: > On Вт, ноя 12, 2019 at 14:08, Andreas Schwab > wrote: > >On Nov 12 2019, Konstantin Kha

Re: [PATCH v3] gdbinit.in: allow to pass function argument explicitly

2019-11-14 Thread Konstantin Kharlamov
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

Re: [PATCH v3] gdbinit.in: allow to pass function argument explicitly

2019-11-15 Thread Konstantin Kharlamov
On Пт, ноя 15, 2019 at 00:17, Konstantin Kharlamov 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

[PATCH 1/2] gdbinit.in: call a function with "call", not "set"

2019-11-12 Thread Konstantin Kharlamov
Last time a command that calls a function of debuggee with "set" was added is 2013 year. Apparently something has changed since then, since doing "set foo()" in gdb to call a "foo()" results in error. Disregarding, it looks wrong to call a function with "set". Let's use "call" instead. *

[PATCH 2/2] gdbinit.in: fix wrong reference to function argument

2019-11-12 Thread Konstantin Kharlamov
Gdb documentation says that gdb-defined functions refer to their args as $arg0…$argN. The just "$" that gdbinit is using here refers to something else, which results in gdb errors, or even crashes of debuggee. Let's fix that. * (debug,debug_rtx,pr,prl,pt,pct,pgg,pgq,pgq,pgs,pge,pmz,ptc,

[PATCH 0/2] gdbinit.in fixes

2019-11-12 Thread Konstantin Kharlamov
This includes the unmerged previously posted here patch about calling with `call`. I made a typo in commit message formatting, so I fix it here. I'd like to note that I am not subscribed to the list, so please add me to CC when replying. Thanks in advance. Konstantin Kharlamov (2): gdbinit.in

Re: [PATCH 2/2] gdbinit.in: fix wrong reference to function argument

2019-11-12 Thread Konstantin Kharlamov
On Вт, ноя 12, 2019 at 13:50, Andreas Schwab wrote: On Nov 12 2019, Konstantin Kharlamov wrote: Gdb documentation says that gdb-defined functions refer to their args as $arg0…$argN. The just "$" that gdbinit is using here refers to something else, That's the last thi

Re: [PATCH 2/2] gdbinit.in: fix wrong reference to function argument

2019-11-12 Thread Konstantin Kharlamov
On Вт, ноя 12, 2019 at 14:08, Andreas Schwab wrote: On Nov 12 2019, Konstantin Kharlamov wrote: I'm definitely missing something. Who are these users, and how can they make anything useful of these functions if they don't even pass an argument? By printing the desired value. Hah

[PATCH] gdbinit.in: call a function with "call", not "set"

2019-11-08 Thread Konstantin Kharlamov
Last time a command that calls a function of debuggee with "set" was added is 2013 year. Apparently something has changed since then, since doing "set foo()" in gdb to call a "foo()" results in error. Disregarding, it looks wrong to call a function with "set". Let's use "call" instead.

[PATCH v2 0/2] gdbinit.in fixes

2019-11-14 Thread Konstantin Kharlamov
A follow-up to previous post. The 1st patch was approved Jeff Law given changelog is fixed. The second one is a compromise that came up in discussion to the previous patchset. Please add me to CC when replying, I'm not subscribed to the list. Konstantin Kharlamov (2): gdbinit.in: call

[PATCH v2 1/2] gdbinit.in: call a function with "call", not "set"

2019-11-14 Thread Konstantin Kharlamov
Calling a function foo in gdb as "set foo()" results in a warning. Disregarding, it looks wrong to call a function with "set". Let's use "call" instead. 2019-11-14 Konstantin Kharlamov * gdbinit.in (pr, prl, pt, pct, pgg, pgq, pgs, pge, pmz, pdd, pbs, pb

[PATCH v2 2/2] gdbinit.in: allow to pass function argument explicitly

2019-11-14 Thread Konstantin Kharlamov
a user passed an argument, and either use it or go with older behavior. 2019-11-14 Konstantin Kharlamov * 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 --- gcc/gdbinit.in

Re: [PATCH v2 2/2] gdbinit.in: allow to pass function argument explicitly

2019-11-14 Thread Konstantin Kharlamov
On Чт, ноя 14, 2019 at 15:55, Alexander Monakov wrote: On Thu, 14 Nov 2019, 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

Re: [PATCH] gdbinit.in: make shorthands accept an explicit argument

2020-01-04 Thread Konstantin Kharlamov
Thank you for reviving the patch. I didn't post any updates because I got stuck for some reasons while trying to get GNU assignment, so my contribution would be accepted. Anyway, looks good to me, thanks. On 04.01.2020 16:35, Alexander Monakov wrote: Hi, I'm posting an updated patch for GCC