From fb9347707fa2ca1cd968d56bc7ae29596c6aff81 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 6 Jun 2014 00:02:33 +0200 Subject: [PATCH] guile: Type-check the argument to 'history-append!'. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit gdb/ 2014-06-05 Ludovic Courtès * 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 * gdb.guile/scm-value.exp (test_value_in_inferior): Add test "history-append! type error". --- gdb/ChangeLog | 6 ++++++ gdb/guile/scm-value.c | 4 +++- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.guile/scm-value.exp | 4 ++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e671ff5b513..17f251b250f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2014-06-05 Ludovic Courtès + + * 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 PR mi/15806 diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c index 8e579a4682f..0ae8103efa4 100644 --- a/gdb/guile/scm-value.c +++ b/gdb/guile/scm-value.c @@ -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) { diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 352638847e6..83c57e0b7ff 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-06-05 Ludovic Courtès + + * gdb.guile/scm-value.exp (test_value_in_inferior): Add test + "history-append! type error". + 2014-06-05 Simon Marchi * gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify): Fix diff --git a/gdb/testsuite/gdb.guile/scm-value.exp b/gdb/testsuite/gdb.guile/scm-value.exp index 2784da2e27d..425873e9af5 100644 --- a/gdb/testsuite/gdb.guile/scm-value.exp +++ b/gdb/testsuite/gdb.guile/scm-value.exp @@ -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. -- 2.30.2