]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
guile: Type-check the argument to 'history-append!'.
authorLudovic Courtès <ludo@gnu.org>
Thu, 5 Jun 2014 22:02:33 +0000 (00:02 +0200)
committerLudovic Courtès <ludo@gnu.org>
Thu, 5 Jun 2014 22:05:18 +0000 (00:05 +0200)
gdb/
2014-06-05  Ludovic Courtès  <ludo@gnu.org>

* guile/scm-value.c (gdbscm_history_append_x): Use
'vlscm_get_value_smob_arg_unsafe' instead of
'vlscm_scm_to_value'.

gdb/testsuite/
2014-06-05  Ludovic Courtès  <ludo@gnu.org>

* gdb.guile/scm-value.exp (test_value_in_inferior): Add test
"history-append! type error".

gdb/ChangeLog
gdb/guile/scm-value.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.guile/scm-value.exp

index e671ff5b513675f4068c5372ceb3f3b0bfa9e6e1..17f251b250f984de1b1ecabaac65b3ad75391664 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-05  Ludovic Courtès  <ludo@gnu.org>
+
+       * guile/scm-value.c (gdbscm_history_append_x): Use
+       'vlscm_get_value_smob_arg_unsafe' instead of
+       'vlscm_scm_to_value'.
+
 2014-06-05  Simon Marchi  <simon.marchi@ericsson.com>
 
        PR mi/15806
index 8e579a4682f619fcd563beb01a21482ede14ced5..0ae8103efa4f6341144884db893c2b57f53f41a4 100644 (file)
@@ -1295,9 +1295,11 @@ gdbscm_history_append_x (SCM value)
 {
   int res_index = -1;
   struct value *v;
+  value_smob *v_smob;
   volatile struct gdb_exception except;
 
-  v = vlscm_scm_to_value (value);
+  v_smob = vlscm_get_value_smob_arg_unsafe (value, SCM_ARG1, FUNC_NAME);
+  v = v_smob->value;
 
   TRY_CATCH (except, RETURN_MASK_ALL)
     {
index 352638847e60e6a0eb1f88265ece64c944e22075..83c57e0b7ffefeecbb5800e459a91d49eb01e359 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-05  Ludovic Courtès  <ludo@gnu.org>
+
+       * gdb.guile/scm-value.exp (test_value_in_inferior): Add test
+       "history-append! type error".
+
 2014-06-05  Simon Marchi  <simon.marchi@ericsson.com>
 
        * gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify): Fix
index 2784da2e27d12510c67931e10e382e45ce1677da..425873e9af5ef7784acc5895fd16df0682668564 100644 (file)
@@ -71,6 +71,10 @@ proc test_value_in_inferior {} {
     gdb_test_no_output "guile (gc)"
     gdb_test "p \$\$" "= 42"
 
+    # Make sure 'history-append!' rejects non-value objects.
+    gdb_test "gu (history-append! 123)" \
+       "ERROR:.* Wrong type argument.*" "history-append! type error"
+
     # Test dereferencing the argv pointer.
 
     # Just get inferior variable argv the value history, available to guile.