aboutsummaryrefslogtreecommitdiff
path: root/gdb/guile/scm-value.c
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-02-18 23:35:46 +0100
committerLudovic Courtès <ludo@gnu.org>2014-02-26 22:59:42 +0100
commit7a5a839f3a82e23f7745dd9905191716c74e34df (patch)
tree0bfa29f6b2fd02081e561ad88e9821f72591bbe6 /gdb/guile/scm-value.c
parentd763de106f7146d7b972f98c7d0113f80a65e4f5 (diff)
downloadgdb-7a5a839f3a82e23f7745dd9905191716c74e34df.zip
gdb-7a5a839f3a82e23f7745dd9905191716c74e34df.tar.gz
gdb-7a5a839f3a82e23f7745dd9905191716c74e34df.tar.bz2
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!'.
Diffstat (limited to 'gdb/guile/scm-value.c')
-rw-r--r--gdb/guile/scm-value.c25
1 files changed, 25 insertions, 0 deletions
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! <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
};