From: Andy Wingo <wingo@igalia.com>
To: gdb-patches@sourceware.org
Cc: Andy Wingo <wingo@igalia.com>
Subject: [PATCH 2/9] Define and export Guile classes for all GDB object types
Date: Wed, 09 Apr 2014 16:14:00 -0000 [thread overview]
Message-ID: <1397060028-18158-3-git-send-email-wingo@igalia.com> (raw)
In-Reply-To: <1397060028-18158-1-git-send-email-wingo@igalia.com>
* gdb/guile/scm-gsmob.c (gdbscm_make_smob_type): Define a binding for a
GOOPS class corresponding to the SMOB type. In Guile 2.0, this
binding is also exported by (oop goops), but this is no longer the
case in Guile 2.2, so we take care of doing that here.
(gdbscm_initialize_smobs): Load GOOPS, so that we can ensure the
classes actually get created.
* gdb/guile/lib/gdb.scm: Export the GOOPS classes.
* gdb/testsuite/gdb.guile/scm-generics.exp: Import (gdb) in the test so
that we have access to the <gdb:value> type in Guile 2.2.
---
gdb/guile/lib/gdb.scm | 18 ++++++++++++++++++
gdb/guile/scm-gsmob.c | 14 +++++++++++++-
gdb/testsuite/gdb.guile/scm-generics.exp | 2 +-
3 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/gdb/guile/lib/gdb.scm b/gdb/guile/lib/gdb.scm
index f12769e..37f0934 100644
--- a/gdb/guile/lib/gdb.scm
+++ b/gdb/guile/lib/gdb.scm
@@ -278,6 +278,24 @@
gsmob-has-property?
gsmob-properties
+ <gdb:value>
+ <gdb:block>
+ <gdb:iterator>
+ <gdb:pretty-printer-worker>
+ <gdb:pretty-printer>
+ <gdb:sal>
+ <gdb:symtab>
+ <gdb:frame>
+ <gdb:block-symbols-iterator>
+ <gdb:field>
+ <gdb:type>
+ <gdb:arch>
+ <gdb:exception>
+ <gdb:objfile>
+ <gdb:lazy-string>
+ <gdb:breakpoint>
+ <gdb:symbol>
+
;; scm-string.c
string->argv
diff --git a/gdb/guile/scm-gsmob.c b/gdb/guile/scm-gsmob.c
index b0f9e19..4c88ff9 100644
--- a/gdb/guile/scm-gsmob.c
+++ b/gdb/guile/scm-gsmob.c
@@ -120,7 +120,17 @@ gdbscm_is_gsmob (SCM scm)
scm_t_bits
gdbscm_make_smob_type (const char *name, size_t size)
{
- scm_t_bits result = scm_make_smob_type (name, size);
+ scm_t_bits result;
+ SCM klass;
+ char *class_name;
+
+ result = scm_make_smob_type (name, size);
+
+ klass = scm_smob_class[SCM_TC2SMOBNUM (result)];
+ gdb_assert (SCM_UNPACK (klass) != 0);
+ class_name = xstrprintf ("<%s>", name);
+ scm_c_define (class_name, klass);
+ xfree (class_name);
register_gsmob (result);
return result;
@@ -475,6 +485,8 @@ Return an unsorted list of names of properties." },
void
gdbscm_initialize_smobs (void)
{
+ scm_c_use_module ("oop goops");
+
registered_gsmobs = htab_create_alloc (10,
hash_scm_t_bits, eq_scm_t_bits,
NULL, xcalloc, xfree);
diff --git a/gdb/testsuite/gdb.guile/scm-generics.exp b/gdb/testsuite/gdb.guile/scm-generics.exp
index 664affc..93ab0e5 100644
--- a/gdb/testsuite/gdb.guile/scm-generics.exp
+++ b/gdb/testsuite/gdb.guile/scm-generics.exp
@@ -30,7 +30,7 @@ gdb_reinitialize_dir $srcdir/$subdir
gdb_install_guile_utils
gdb_install_guile_module
-gdb_test_no_output "guile (use-modules ((oop goops)))"
+gdb_test_no_output "guile (use-modules (oop goops) (gdb))"
gdb_test_no_output "guile (define-generic +)"
gdb_test_no_output "guile (define-method (+ (x <gdb:value>) (y <gdb:value>)) (value-add x y))"
--
1.9.1
next prev parent reply other threads:[~2014-04-09 16:14 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-09 16:14 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
2014-04-09 16:14 ` Andy Wingo [this message]
2014-04-12 18:32 ` [PATCH 2/9] Define and export Guile classes for all GDB object types Doug Evans
2014-04-09 16:14 ` [PATCH 3/9] Fix excess parentheses in Guile extension examples Andy Wingo
2014-04-09 16:14 ` [PATCH 5/9] Rename "gsmob" in Guile interface to "gdb object" Andy Wingo
2014-04-12 18:46 ` Doug Evans
2014-04-17 9:39 ` Andy Wingo
2014-04-17 9:46 ` Eli Zaretskii
2014-04-09 16:14 ` [PATCH 6/9] Remove Guile GDB object property mechanism Andy Wingo
2014-04-12 19:23 ` Doug Evans
2014-04-17 9:54 ` Andy Wingo
2014-04-09 16:14 ` [PATCH 7/9] Remove Guile mark functions that don't mark anything Andy Wingo
2014-04-12 19:29 ` Doug Evans
2014-04-17 9:48 ` Andy Wingo
2014-04-20 19:34 ` Doug Evans
2014-04-22 7:40 ` Andy Wingo
2014-04-29 11:51 ` Ludovic Courtès
2014-04-09 16:14 ` [PATCH 4/9] Fix typos in documentation of Guile `execute' function Andy Wingo
2014-04-09 16:14 ` [PATCH 8/9] Remove useless Guile SMOB marking functions Andy Wingo
2014-04-12 19:50 ` Doug Evans
2014-04-09 16:14 ` [PATCH 1/9] Allow GDB to build against unreleased Guile 2.2 Andy Wingo
2014-04-12 16:40 ` Doug Evans
2014-04-12 16:47 ` Doug Evans
2014-04-17 9:04 ` Andy Wingo
2014-04-09 16:14 ` [PATCH 9/9] Remove a useless Guile finalizer Andy Wingo
2014-04-12 20:18 ` Doug Evans
2014-04-14 12:12 ` Ludovic Courtès
2014-04-14 21:39 ` Doug Evans
2014-04-15 9:29 ` Ludovic Courtès
2014-04-15 15:30 ` Doug Evans
2014-04-17 10:07 ` Andy Wingo
-- strict thread matches above, loose matches on Subject: below --
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
2014-04-09 16:09 ` [PATCH 2/9] Define and export Guile classes for all GDB object types Andy Wingo
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=1397060028-18158-3-git-send-email-wingo@igalia.com \
--to=wingo@igalia.com \
--cc=gdb-patches@sourceware.org \
/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