From patchwork Wed Apr 9 16:08:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Wingo X-Patchwork-Id: 441 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (peon2454.g.dreamhost.com [208.113.200.127]) by wilcox.dreamhost.com (Postfix) with ESMTP id 5E56136005B for ; Wed, 9 Apr 2014 09:09:23 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14314964) id 0C55B122A75A; Wed, 9 Apr 2014 09:09:22 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx21.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-mx21.g.dreamhost.com (Postfix) with ESMTPS id C5AED12A5901 for ; Wed, 9 Apr 2014 09:09:22 -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=PFfDloS7opko45IBq5zdT0gnBag5HIM v+ncU27KWHyaQf9zb7xfktXKHH9hLh2nsdS6LjuDvh2QJcdqt1BFG3n+zCKSbQHN jcMFntr5bcLv4UIH0bZy7+zIytiLQtGbhaDzR7aMK7IgGRB2rKnRurwSm1VEz4xg hQVIqr88zQig= 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=yb9gK qTqDx+cZvu2rNeQuvJ81bFzxEECSAAKC667MLu6L2UT0oAvtW02b0Yv96olFOdVZ LAdeFNqpMuG6MN4fXP3sGqTteMHJ/y51UolpJgE/UYqm23/t4wJwKTzcXVB283mW ViFplkN4CzVNWWaGtwzzaDVE040cZSg2il2slM= Received: (qmail 23584 invoked by alias); 9 Apr 2014 16:09:19 -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 23485 invoked by uid 89); 9 Apr 2014 16:09:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=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:09:17 +0000 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 2DBA710F83; Wed, 9 Apr 2014 12:09:16 -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 2433B10F82; Wed, 9 Apr 2014 12:09:16 -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 7AC5110F7E; Wed, 9 Apr 2014 12:09:13 -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:08:31 +0200 Message-Id: <1397059725-18066-3-git-send-email-wingo@igalia.com> In-Reply-To: <1397059725-18066-1-git-send-email-wingo@igalia.com> References: <1397059725-18066-1-git-send-email-wingo@igalia.com> X-Pobox-Relay-ID: 4B9EDABC-C001-11E3-85D9-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))"