This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

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




On Чт, ноя 14, 2019 at 16:13, Alexander Monakov <amonakov@ispras.ru> 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 to avoid duplicating
the commands over and over again. Can we use something like

  define pp
  if $argc
   p $arg0
  end
  call debug ($)
  end

this way

  pp something

is simply equivalent to what people already use:

  p something
  pp

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 the code to be like this:

define pp
 if ($argc == 0)
   set $arg = $
 else
   set $arg = $arg0
 end
 call debug ($arg)
end




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