From 7a5a839f3a82e23f7745dd9905191716c74e34df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 18 Feb 2014 23:35:46 +0100 Subject: guile: Add 'history-append!' procedure. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gdb/ 2014-02-26 Ludovic Courtès * guile/scm-value.c (gdbscm_history_append_x): New function. (value_functions): Add it. gdb/testsuite/ 2014-02-26 Ludovic Courtès * gdb.guile/scm-value.exp (test_value_in_inferior): Add test for 'history-append!'. gdb/doc/ 2014-02-26 Ludovic Courtès * gdb/doc/guile.texi (Basic Guile): Document 'history-append!'. --- gdb/guile/scm-value.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'gdb/guile/scm-value.c') diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c index f7f27cee..8ca0762 100644 --- a/gdb/guile/scm-value.c +++ b/gdb/guile/scm-value.c @@ -1297,6 +1297,27 @@ gdbscm_history_ref (SCM index) return vlscm_scm_from_value (res_val); } + +/* (history-append! ) -> 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 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 }; -- cgit v1.1