On Чт, ноя 14, 2019 at 16:57, Alexander Monakov
<amona...@ispras.ru> 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 the code to be like this:
define pp
if ($argc == 0)
set $arg = $
else
set $arg = $arg0
end
call debug ($arg)
end
I wish there was a less verbose way :) I don't insist on this
deduplication, so
at this point I guess it's up to the reviewers. Your suggestion
seems slightly
preferable to duplicating commands, but please wait for feedback from
others.
Sure; you know, actually I just found out how we can deduplicate the
code! Can we use this or not depends on whether we can tolerate
dependency on python (I dunno, I can ‾\_(ツ)_/‾). The code:
py
def choose_arg0_into_gdbarg():
if gdb.execute('output $argc', to_string=True) == '1':
gdb.execute('set debug_arg = $arg0', to_string=True)
else:
gdb.execute('set debug_arg = $', to_string=True)
end
define pp
py choose_arg0_into_gdbarg()
call debug (debug_arg)
end
I also named `dbgarg` as `debug_arg` because I figured I confuse
whether it was `gdbarg` or `gdbarg` :D