From: ludo@gnu.org (Ludovic Courtès)
To: gdb@sourceware.org, Doug Evans <xdje42@gmail.com>
Subject: [PATCH] guile: Type-check the argument to 'history-append!'
Date: Thu, 05 Jun 2014 12:51:00 -0000 [thread overview]
Message-ID: <87vbsfv7t9.fsf@gnu.org> (raw)
The patch below add a missing type check in ‘history-append!’ (I’m guilty.)
OK to push?
Ludo’.
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".
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index 8e579a4..0ae8103 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/gdb.guile/scm-value.exp b/gdb/testsuite/gdb.guile/scm-value.exp
index 2784da2..425873e 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.
next reply other threads:[~2014-06-05 12:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-05 12:51 Ludovic Courtès [this message]
2014-06-05 16:35 ` Doug Evans
2014-06-05 22:06 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vbsfv7t9.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=gdb@sourceware.org \
--cc=xdje42@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox