guile: Add 'history-append!' procedure.
[deliverable/binutils-gdb.git] / gdb / guile / scm-value.c
index f7f27ceea8081c5a8c409249c41592277f8f6c08..8ca076211c4c963fa714a1cc4096f3c7ad7d21ea 100644 (file)
@@ -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);
+}
 \f
 /* 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
 };
 
This page took 0.024062 seconds and 4 git commands to generate.