guile: Add 'history-append!' procedure.
gdb/ 2014-02-26 Ludovic Courtès <ludo@gnu.org> * guile/scm-value.c (gdbscm_history_append_x): New function. (value_functions): Add it. gdb/testsuite/ 2014-02-26 Ludovic Courtès <ludo@gnu.org> * gdb.guile/scm-value.exp (test_value_in_inferior): Add test for 'history-append!'. gdb/doc/ 2014-02-26 Ludovic Courtès <ludo@gnu.org> * gdb/doc/guile.texi (Basic Guile): Document 'history-append!'.
This commit is contained in:
parent
d763de106f
commit
7a5a839f3a
|
@ -1,3 +1,8 @@
|
|||
2014-02-26 Ludovic Courtès <ludo@gnu.org>
|
||||
|
||||
* guile/scm-value.c (gdbscm_history_append_x): New function.
|
||||
(value_functions): Add it.
|
||||
|
||||
2014-02-27 Joel Brobecker <brobecker@adacore.com>
|
||||
|
||||
* dwarf2read.c (attr_value_as_address): New function.
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2014-02-26 Ludovic Courtès <ludo@gnu.org>
|
||||
|
||||
* gdb/doc/guile.texi (Basic Guile): Document 'history-append!'.
|
||||
|
||||
2014-02-20 Joel Brobecker <brobecker@adacore.com>
|
||||
|
||||
* gdb.texinfo (Files): Document "add-shared-symbol-files"
|
||||
|
|
|
@ -278,6 +278,15 @@ history contains the result of evaluating an expression from Guile's
|
|||
command line.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} history-append! value
|
||||
Append @var{value}, an instance of @code{<gdb:value>}, to @value{GDBN}'s
|
||||
value history. Return its index in the history.
|
||||
|
||||
Putting into history values returned by Guile extensions will allow
|
||||
the user convenient access to those values via CLI history
|
||||
facilities.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} parse-and-eval expression
|
||||
Parse @var{expression} as an expression in the current language,
|
||||
evaluate it, and return the result as a @code{<gdb:value>}.
|
||||
|
|
|
@ -1297,6 +1297,27 @@ gdbscm_history_ref (SCM index)
|
|||
|
||||
return vlscm_scm_from_value (res_val);
|
||||
}
|
||||
|
||||
/* (history-append! <gdb:value>) -> index
|
||||
Append VALUE to GDB's value history. Return its index in the history. */
|
||||
|
||||
static SCM
|
||||
gdbscm_history_append_x (SCM value)
|
||||
{
|
||||
int res_index = -1;
|
||||
struct value *v;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
v = vlscm_scm_to_value (value);
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
res_index = record_latest_value (v);
|
||||
}
|
||||
GDBSCM_HANDLE_GDB_EXCEPTION (except);
|
||||
|
||||
return scm_from_int (res_index);
|
||||
}
|
||||
|
||||
/* Initialize the Scheme value code. */
|
||||
|
||||
|
@ -1459,6 +1480,10 @@ Evaluates string in gdb and returns the result as a <gdb:value> object." },
|
|||
"\
|
||||
Return the specified value from GDB's value history." },
|
||||
|
||||
{ "history-append!", 1, 0, 0, gdbscm_history_append_x,
|
||||
"\
|
||||
Append the specified value onto GDB's value history." },
|
||||
|
||||
END_FUNCTIONS
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2014-02-26 Ludovic Courtès <ludo@gnu.org>
|
||||
|
||||
* gdb.guile/scm-value.exp (test_value_in_inferior): Add
|
||||
test for 'history-append!'.
|
||||
|
||||
2014-02-26 Joel Brobecker <brobecker@adacore.com>
|
||||
|
||||
* gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S: New file.
|
||||
|
|
|
@ -59,6 +59,14 @@ proc test_value_in_inferior {} {
|
|||
gdb_test "gu (print (value-field s \"a\"))" \
|
||||
"= 3" "access element inside struct using string name"
|
||||
|
||||
# Append value in the value history.
|
||||
gdb_scm_test_silent_cmd "gu (define i (history-append! (make-value 42)))" \
|
||||
"append 42"
|
||||
|
||||
gdb_test "gu i" "\[0-9\]+"
|
||||
gdb_test "gu (history-ref i)" "#<gdb:value 42>"
|
||||
gdb_test "p \$" "= 42"
|
||||
|
||||
# Test dereferencing the argv pointer.
|
||||
|
||||
# Just get inferior variable argv the value history, available to guile.
|
||||
|
|
Loading…
Reference in New Issue