This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] guile: Add 'history-push!' procedure
- From: ludo at gnu dot org (Ludovic CourtÃs)
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb-patches at sourceware dot org, xdje42 at gmail dot com
- Date: Wed, 19 Feb 2014 22:43:43 +0100
- Subject: Re: [PATCH] guile: Add 'history-push!' procedure
- Authentication-results: sourceware.org; auth=none
- References: <871tz06o4x dot fsf at gnu dot org> <83txbv69z9 dot fsf at gnu dot org>
Eli Zaretskii <eliz@gnu.org> skribis:
>> From: ludo@gnu.org (Ludovic CourtÃs)
>> Date: Tue, 18 Feb 2014 23:40:14 +0100
>>
>> This patch adds the âhistory-push!â procedure to add a value in the
>> history.
>
> Thanks.
>
>> +@deffn {Scheme Procedure} history-push! value
>> +Push @var{value}, an instance of @code{<gdb:value>}, to @value{GDBN}'s
>> +value history.
>
> I think we should explain what "push" means in this context. It is
> not self-evident.
Right. How about s/push/append/? (In the procedure name as well.)
>> Return its index in the history, or @code{#f} if it is
>> +not saved.
>
> Why would it not be saved?
Good question. The doc above ârecord_latest_valueâ mentions that it can
return -1, but I see no path leading to that. Can I assume that -1 is
never returned?
>> +This function is useful to make it easier to access individual values
>> +from a set of values displayed by a user function.
>
> Not sure what this sentence is about. "Easier" how, and what do you
> mean by "user function"?
By âuser functionâ, I mean a Scheme procedure written by the user to
extend GDB functionality. Such a procedure might display several
valuesâone example is the Guile VM stack walker, which displays local
variables. Instead of simply displaying something like this:
--8<---------------cut here---------------start------------->8---
(gdb) gu (display-vm-frames)
#0 #<program 7ffff5d0e420>
slot 0 -> "scheme@(guile-user)> "
slot 1 -> #<port file 6f70a0>
slot 2 -> #<port file 6f7070>
slot 3 -> #<program bc8100>
[...]
--8<---------------cut here---------------end--------------->8---
it could instead display something like this:
--8<---------------cut here---------------start------------->8---
(gdb) gu (display-vm-frames)
#0 #<program 7ffff5d0e420>
$12 -> "scheme@(guile-user)> "
$13 -> #<port file 6f70a0>
$14 -> #<port file 6f7070>
$15 -> #<program bc8100>
[...]
--8<---------------cut here---------------end--------------->8---
... thus allowing users to directly refer to $12 etc.
How about simply this:
Using this function is useful to provide convenient access to values
manipulated by a Guile extension of GDB.
Thanks,
Ludoâ.