From patchwork Thu Apr 17 10:46:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Wingo X-Patchwork-Id: 597 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 3530436005B for ; Thu, 17 Apr 2014 03:47:29 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14314964) id E6C3E1124A4A; Thu, 17 Apr 2014 03:47:28 -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 B4C0511D9C2B for ; Thu, 17 Apr 2014 03:47:28 -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=mBBRGvNztlfutUq7uqOfc1aluS8Nm85 2FP8uto41wijn75Jpunin0M52IiRymMk9qvUGU1gvtLokGaybGsjvjl4VNpH2lmc WEQoqGtiIRrqFuvBHJw9FS2nBTIBuqs77dry9E3dm/3SCP93XkYE9mVbVvqk+/W2 uPPV2ejmG0YI= 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=9WYHbs0DO8N3SbEn/Qx4vCCPBwg=; b=htc7K qYdO35e2dmPrpzaxjmzSNqFG9QrlonR0YaMrRvfEWmth3/ci1MZM0c8rUB+hxm6D Gx1t4M4hYJjN3/JXYyZQMuB+56o6WIvPKrZNUcvUHGEAlThUO2laibuIJUTGeUq3 2C4wPJNMziOgZ74EQUwtCiAEdivurro41l7Gm8= Received: (qmail 26177 invoked by alias); 17 Apr 2014 10:47:21 -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 26114 invoked by uid 89); 17 Apr 2014 10:47:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.0 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, 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; Thu, 17 Apr 2014 10:47:19 +0000 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 1F858F039; Thu, 17 Apr 2014 06:47:18 -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 18735F038; Thu, 17 Apr 2014 06:47:18 -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 5EAB7F037; Thu, 17 Apr 2014 06:47:15 -0400 (EDT) From: Andy Wingo To: gdb-patches@sourceware.org Cc: Andy Wingo Subject: [PATCH v2 2/9] Define and export Guile classes for all GDB object types Date: Thu, 17 Apr 2014 12:46:21 +0200 Message-Id: <1397731588-23750-3-git-send-email-wingo@igalia.com> In-Reply-To: <1397731588-23750-1-git-send-email-wingo@igalia.com> References: <1397731588-23750-1-git-send-email-wingo@igalia.com> X-Pobox-Relay-ID: A46DC636-C61D-11E3-B930-873F0E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-DH-Original-To: gdb@patchwork.siddhesh.in gdb/ChangeLog: * guile/scm-gsmob.c (gdbscm_make_smob_type): Define a binding for a GOOPS class corresponding to the SMOB type. (gdbscm_initialize_smobs): Load GOOPS. * guile/lib/gdb.scm: Export the GOOPS classes. --- gdb/ChangeLog | 8 ++++++++ gdb/guile/lib/gdb.scm | 17 +++++++++++++++++ gdb/guile/scm-gsmob.c | 20 +++++++++++++++++++- gdb/testsuite/gdb.guile/scm-generics.exp | 2 +- 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ec8f7b2..36dbce0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2014-04-17 Andy Wingo + * guile/scm-gsmob.c (gdbscm_make_smob_type): Define a binding + for a GOOPS class corresponding to the SMOB type. + (gdbscm_initialize_smobs): Load GOOPS. + + * guile/lib/gdb.scm: Export the GOOPS classes. + +2014-04-17 Andy Wingo + * configure.ac (try_guile_versions): Allow building with Guile 2.2. * configure: Regenerate. diff --git a/gdb/guile/lib/gdb.scm b/gdb/guile/lib/gdb.scm index f12769e..98eb388 100644 --- a/gdb/guile/lib/gdb.scm +++ b/gdb/guile/lib/gdb.scm @@ -50,6 +50,7 @@ ;; scm-arch.c + arch? current-arch arch-name @@ -85,6 +86,7 @@ ;; scm-block.c + block? block-valid? block-start @@ -96,6 +98,7 @@ block-global? block-static? block-symbols + make-block-symbols-iterator block-symbols-progress? lookup-block @@ -113,6 +116,7 @@ WP_WRITE WP_ACCESS + make-breakpoint breakpoint-delete! breakpoints @@ -147,6 +151,7 @@ ;; scm-exception.c + make-exception exception? exception-key @@ -170,6 +175,7 @@ FRAME_UNWIND_SAME_ID FRAME_UNWIND_NO_SAVED_PC + frame? frame-valid? frame-name @@ -190,6 +196,7 @@ ;; scm-iterator.c + make-iterator iterator? iterator-object @@ -202,6 +209,7 @@ ;; scm-lazy-string.c ;; FIXME: Where's the constructor? + lazy-string? lazy-string-address lazy-string-length @@ -238,6 +246,7 @@ ;; scm-objfile.c + objfile? objfile-valid? objfile-filename @@ -263,10 +272,12 @@ ;; scm-pretty-print.c + make-pretty-printer pretty-printer? pretty-printer-enabled? set-pretty-printer-enabled! + make-pretty-printer-worker pretty-printer-worker? @@ -308,6 +319,7 @@ SYMBOL_FUNCTIONS_DOMAIN SYMBOL_TYPES_DOMAIN + symbol? symbol-valid? symbol-type @@ -328,6 +340,7 @@ ;; scm-symtab.c + symtab? symtab-valid? symtab-filename @@ -335,6 +348,7 @@ symtab-objfile symtab-global-block symtab-static-block + sal? sal-valid? sal-symtab @@ -372,6 +386,7 @@ TYPE_CODE_DECFLOAT TYPE_CODE_INTERNAL_FUNCTION + type? lookup-type type-code @@ -394,6 +409,7 @@ make-field-iterator type-field type-has-field? + field? field-name field-type @@ -405,6 +421,7 @@ ;; scm-value.c + value? make-value value-optimized-out? diff --git a/gdb/guile/scm-gsmob.c b/gdb/guile/scm-gsmob.c index b0f9e19..1fbd193 100644 --- a/gdb/guile/scm-gsmob.c +++ b/gdb/guile/scm-gsmob.c @@ -120,7 +120,22 @@ 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; + + /* In Guile 2.0, defining a new SMOB type causes the binding to also be + exported by (oop goops), but this is deprecated behavior and is no longer + the case in Guile 2.2. Here we arrange to export the class names from + (gdb). */ + + 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 +490,9 @@ Return an unsorted list of names of properties." }, void gdbscm_initialize_smobs (void) { + /* Load GOOPS, so that scm_make_smob_type defines GOOPS classes eagerly. */ + 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..b64ea11 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_test_no_output "guile (define-generic +)" gdb_test_no_output "guile (define-method (+ (x ) (y )) (value-add x y))"