From patchwork Wed Apr 9 16:13:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Wingo X-Patchwork-Id: 458 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 0327E36005B for ; Wed, 9 Apr 2014 09:14:18 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14314964) id AF41562577A04; Wed, 9 Apr 2014 09:14:18 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx23.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx23.g.dreamhost.com (Postfix) with ESMTPS id 8AAAD62624130 for ; Wed, 9 Apr 2014 09:14:18 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Na3ckGBm1b6UQ6aIeF3Bq8fKBf3fWpo NOIzNu9gznwgJL9sgZCVf1FUi8IBkmpbibRYSkyozW4JqhT+m0HlO7FSc8cb8DK9 52KbX4tOA1rAq6QeccDlzG8SkPKaJwm/D+oCK98JLYU3s7tEC4tenOD2Xq+fW2d7 KV39uwrI5MA8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=Hl+S4JUkxNR8aE8Dkp0bESjjjtY=; b=Hul1i Y2ni7lEXIyrMtZudGr6ykVPbwQw/ijLxZKGRl8M2vTwA7dcM80dOrls+grLBzxG2 WpO/7srFk8tjswhUmj+hQlzcvqbDvSTaIkACLuAyY1G+ApRJdM4dJvnBv+iddJ10 6BW0eFrcVoc19/l9dFwu7gxdprm1LhF1PtaE4w= Received: (qmail 5508 invoked by alias); 9 Apr 2014 16:14:09 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 5396 invoked by uid 89); 9 Apr 2014 16:14:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_NEUTRAL autolearn=no version=3.3.2 X-HELO: sasl.smtp.pobox.com Received: from a-pb-sasl-quonix.pobox.com (HELO sasl.smtp.pobox.com) (208.72.237.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Apr 2014 16:14:08 +0000 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 95BF41104D; Wed, 9 Apr 2014 12:14:06 -0400 (EDT) Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 8EB931104C; Wed, 9 Apr 2014 12:14:06 -0400 (EDT) Received: from localhost.localdomain (unknown [88.160.190.192]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id E765C1104A; Wed, 9 Apr 2014 12:14:03 -0400 (EDT) From: Andy Wingo To: gdb-patches@sourceware.org Cc: Andy Wingo Subject: [PATCH 2/9] Define and export Guile classes for all GDB object types Date: Wed, 9 Apr 2014 18:13:41 +0200 Message-Id: <1397060028-18158-3-git-send-email-wingo@igalia.com> In-Reply-To: <1397060028-18158-1-git-send-email-wingo@igalia.com> References: <1397060028-18158-1-git-send-email-wingo@igalia.com> X-Pobox-Relay-ID: F8BC83C0-C001-11E3-B133-873F0E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-DH-Original-To: gdb@patchwork.siddhesh.in * 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 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 + + + + + + + + + + + + + + + + + + ;; 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 ) (y )) (value-add x y))"