From patchwork Thu Apr 17 10:46:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Wingo X-Patchwork-Id: 600 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx22.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 918D636005B for ; Thu, 17 Apr 2014 03:47:51 -0700 (PDT) Received: by homiemail-mx22.g.dreamhost.com (Postfix, from userid 14314964) id 31D7A4AB6C67; Thu, 17 Apr 2014 03:47:51 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx22.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-mx22.g.dreamhost.com (Postfix) with ESMTPS id E812C4AB6C67 for ; Thu, 17 Apr 2014 03:47:50 -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=GQ4gfyHa5OFr1mww/nu/xCsdtQnthW9 vQKgjefQoPR/a9JgaC48DKBJ1hy/M0hOPoDjTKYgj5uAVj0cQ9B3Z7Ze43+mIvFD hice26abcwJKiKmzXE+BQNlwS2D8cR9MgqM5pgBG5olfqUYg1o/FdsgMATqgklop ny5La+2nsziQ= 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=7qa27gtD5wPYLIQBZnKCqMQqoOQ=; b=EQcX0 f27kfnW3IcpzvCr+6lOn2QTemBlR/l+zh7y8TudkjmtEvFUJc0bsUPjQ2WXLm3xQ qQNeHbMJPZNWLeNtD7A41CFc14yPixTWyrxfocYNwBZXx5SW68ycEvm5cD6Voe0b RTB3nHC0AEfsgT6Is1ddmTCkyUhNJVkl7Ygts8= Received: (qmail 27165 invoked by alias); 17 Apr 2014 10:47:31 -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 27091 invoked by uid 89); 17 Apr 2014 10:47:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 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; Thu, 17 Apr 2014 10:47:28 +0000 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id AA38DF042; Thu, 17 Apr 2014 06:47:26 -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 A30FCF041; Thu, 17 Apr 2014 06:47:26 -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 9A59DF040; Thu, 17 Apr 2014 06:47:23 -0400 (EDT) From: Andy Wingo To: gdb-patches@sourceware.org Cc: Andy Wingo Subject: [PATCH v2 5/9] Rename "gsmob" in Guile interface to "gdb object" Date: Thu, 17 Apr 2014 12:46:24 +0200 Message-Id: <1397731588-23750-6-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: A957BF8A-C61D-11E3-8528-873F0E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-DH-Original-To: gdb@patchwork.siddhesh.in gdb/ChangeLog: * guile/scm-gsmob.c: * guile/lib/gdb.scm (gdb-object-kind, gdb-object-property) (set-gdb-object-property!, gdb-object-has-property?) (gadb-object-properties): Rename from gsmob-kind, gsmob-property, etc. The fact that these are SMOBs is a C implementation detail that should not be exposed to Scheme. gdb/doc/ChangeLog: * guile.texi (GDB Scheme Data Types): Update the manual. gdb/testsuite/ChangeLog: * gdb.guile/scm-breakpoint.exp (test_bkpt_eval_funcs): Adapt to renames. --- gdb/ChangeLog | 9 ++++++++ gdb/doc/ChangeLog | 4 ++++ gdb/doc/guile.texi | 37 +++++++++++++++--------------- gdb/guile/lib/gdb.scm | 12 +++++----- gdb/guile/scm-gsmob.c | 30 ++++++++++++------------ gdb/testsuite/ChangeLog | 5 ++++ gdb/testsuite/gdb.guile/scm-breakpoint.exp | 14 +++++------ gdb/testsuite/gdb.guile/scm-gsmob.exp | 14 +++++------ 8 files changed, 71 insertions(+), 54 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 36dbce0..215798e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,14 @@ 2014-04-17 Andy Wingo + * guile/scm-gsmob.c: + * guile/lib/gdb.scm (gdb-object-kind, gdb-object-property) + (set-gdb-object-property!, gdb-object-has-property?) + (gadb-object-properties): Rename from gsmob-kind, gsmob-property, + etc. The fact that these are SMOBs is a C implementation detail + that should not be exposed to Scheme. + +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. diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 4e07246..bdda307 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,5 +1,9 @@ 2014-04-17 Andy Wingo + * guile.texi (GDB Scheme Data Types): Update the manual. + +2014-04-17 Andy Wingo + * guile.texi (Basic Guile): Fix some typos. 2014-04-17 Andy Wingo diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi index 3f6580e..f7204e9 100644 --- a/gdb/doc/guile.texi +++ b/gdb/doc/guile.texi @@ -331,46 +331,45 @@ This is the string passed to @code{--target} when @value{GDBN} was configured. @node GDB Scheme Data Types @subsubsection GDB Scheme Data Types -@cindex gdb smobs +@cindex gdb objects -@value{GDBN} uses Guile's @dfn{smob} (small object) -data type for all @value{GDBN} objects -(@pxref{Defining New Types (Smobs),,, guile, GNU Guile Reference Manual}). -The smobs that @value{GDBN} provides are called @dfn{gsmobs}. +The values exposed by @value{GDBN} to Guile are known as +@dfn{@value{GDBN} objects}. There are several kinds of @value{GDBN} +object, and each is disjoint from all other types known to Guile. -@deffn {Scheme Procedure} gsmob-kind gsmob -Return the kind of the gsmob, e.g., @code{}, +@deffn {Scheme Procedure} gdb-object-kind object +Return the kind of the @value{GDBN} object, e.g., @code{}, as a symbol. @end deffn -Every @code{gsmob} provides a common set of functions for extending -them in simple ways. Each @code{gsmob} has a list of properties, -initially empty. These properties are akin to Guile's object properties, -but are stored with the @code{gsmob} +Every @value{GDBN} object provides a common set of functions for +extending them in simple ways. Each @value{GDBN} object has a list of +properties, initially empty. These properties are akin to Guile's +object properties, but are stored with the @value{GDBN} object (@pxref{Object Properties,,, guile, GNU Guile Reference Manual}). Property names can be any @code{eq?}-able value, but it is recommended that they be symbols. -@deffn {Scheme Procedure} set-gsmob-property! gsmob property-name value +@deffn {Scheme Procedure} set-gdb-object-property! object property-name value Set the value of property @code{property-name} to value @code{value}. The result is unspecified. @end deffn -@deffn {Scheme Procedure} gsmob-property gsmob property-name +@deffn {Scheme Procedure} gdb-object-property object property-name Return the value of property @code{property-name}. If the property isn't present then @code{#f} is returned. @end deffn -@deffn {Scheme Procedure} gsmob-has-property? gsmob property-name -Return @code{#t} if @code{gsmob} has property @code{property-name}. +@deffn {Scheme Procedure} gdb-object-has-property? object property-name +Return @code{#t} if @value{GDBN} object has property @code{property-name}. Otherwise return @code{#f}. @end deffn -@deffn {Scheme Procedure} gsmob-properties gsmob +@deffn {Scheme Procedure} gdb-object-properties object Return an unsorted list of names of properties. @end deffn -@value{GDBN} defines the following Scheme smobs: +@value{GDBN} defines the following object types: @table @code @item @@ -425,8 +424,8 @@ Return an unsorted list of names of properties. @xref{Values From Inferior In Guile}. @end table -The following gsmobs are managed internally so that the Scheme function -@code{eq?} may be applied to them. +The following @value{GDBN} objects are managed internally so that the +Scheme function @code{eq?} may be applied to them. @table @code @item diff --git a/gdb/guile/lib/gdb.scm b/gdb/guile/lib/gdb.scm index 98eb388..6d5dd61 100644 --- a/gdb/guile/lib/gdb.scm +++ b/gdb/guile/lib/gdb.scm @@ -281,13 +281,13 @@ make-pretty-printer-worker pretty-printer-worker? - ;; scm-smob.c + ;; scm-gsmob.c - gsmob-kind - gsmob-property - set-gsmob-property! - gsmob-has-property? - gsmob-properties + gdb-object-kind + gdb-object-property + set-gdb-object-property! + gdb-object-has-property? + gdb-object-properties ;; scm-string.c diff --git a/gdb/guile/scm-gsmob.c b/gdb/guile/scm-gsmob.c index 1fbd193..6d533b4 100644 --- a/gdb/guile/scm-gsmob.c +++ b/gdb/guile/scm-gsmob.c @@ -48,7 +48,7 @@ Gsmobs (and chained/eqable gsmobs) add an extra field that is used to record extra data: "properties". It is a table of key/value pairs - that can be set with set-gsmob-property!, gsmob-property. */ + that can be set with set-gdb-object-property!, gdb-object-property. */ #include "defs.h" #include "hashtab.h" @@ -227,9 +227,9 @@ gsscm_get_gsmob_arg_unsafe (SCM self, int arg_pos, const char *func_name) return self; } -/* (gsmob-kind gsmob) -> symbol +/* (gdb-object-kind gsmob) -> symbol - Note: While one might want to name this gsmob-class-name, it is named + Note: While one might want to name this gdb-object-class-name, it is named "-kind" because smobs aren't real GOOPS classes. */ static SCM @@ -251,7 +251,7 @@ gdbscm_gsmob_kind (SCM self) return result; } -/* (gsmob-property gsmob property) -> object +/* (gdb-object-property gsmob property) -> object If property isn't present then #f is returned. */ static SCM @@ -270,7 +270,7 @@ gdbscm_gsmob_property (SCM self, SCM property) return scm_assq_ref (base->properties, property); } -/* (set-gsmob-property! gsmob property new-value) -> unspecified */ +/* (set-gdb-object-property! gsmob property new-value) -> unspecified */ static SCM gdbscm_set_gsmob_property_x (SCM self, SCM property, SCM new_value) @@ -311,7 +311,7 @@ gdbscm_set_gsmob_property_x (SCM self, SCM property, SCM new_value) return SCM_UNSPECIFIED; } -/* (gsmob-has-property? gsmob property) -> boolean */ +/* (gdb-object-has-property? gsmob property) -> boolean */ static SCM gdbscm_gsmob_has_property_p (SCM self, SCM property) @@ -341,7 +341,7 @@ add_property_name (void *closure, SCM handle) return SCM_UNSPECIFIED; } -/* (gsmob-properties gsmob) -> list +/* (gdb-object-properties gsmob) -> list The list is unsorted. */ static SCM @@ -464,23 +464,23 @@ gdbscm_clear_eqable_gsmob_ptr_slot (htab_t htab, eqable_gdb_smob *base) static const scheme_function gsmob_functions[] = { - { "gsmob-kind", 1, 0, 0, gdbscm_gsmob_kind, + { "gdb-object-kind", 1, 0, 0, gdbscm_gsmob_kind, "\ -Return the kind of the smob, e.g., , as a symbol." }, +Return the kind of the GDB object, e.g., , as a symbol." }, - { "gsmob-property", 2, 0, 0, gdbscm_gsmob_property, + { "gdb-object-property", 2, 0, 0, gdbscm_gsmob_property, "\ -Return the specified property of the gsmob." }, +Return the specified property of the GDB object." }, - { "set-gsmob-property!", 3, 0, 0, gdbscm_set_gsmob_property_x, + { "set-gdb-object-property!", 3, 0, 0, gdbscm_set_gsmob_property_x, "\ -Set the specified property of the gsmob." }, +Set the specified property of the GDB object." }, - { "gsmob-has-property?", 2, 0, 0, gdbscm_gsmob_has_property_p, + { "gdb-object-has-property?", 2, 0, 0, gdbscm_gsmob_has_property_p, "\ Return #t if the specified property is present." }, - { "gsmob-properties", 1, 0, 0, gdbscm_gsmob_properties, + { "gdb-object-properties", 1, 0, 0, gdbscm_gsmob_properties, "\ Return an unsorted list of names of properties." }, diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 13752ef..48a34b0 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-04-17 Andy Wingo + + * gdb.guile/scm-breakpoint.exp (test_bkpt_eval_funcs): Adapt to + renames. + 2014-04-17 Marcus Shawcroft * lib/gdb.exp (gdb_compile_pthreads, gdb_compile_objc): diff --git a/gdb/testsuite/gdb.guile/scm-breakpoint.exp b/gdb/testsuite/gdb.guile/scm-breakpoint.exp index b25d4e0..4e78791 100644 --- a/gdb/testsuite/gdb.guile/scm-breakpoint.exp +++ b/gdb/testsuite/gdb.guile/scm-breakpoint.exp @@ -310,14 +310,14 @@ proc test_bkpt_eval_funcs { } { "(define set-bp-data-count! set-car!)" "" \ "(define bp-data-inf-i cdr)" "" \ "(define set-bp-data-inf-i! set-cdr!)" "" \ - "(define (bp-eval-count bkpt) (bp-data-count (gsmob-property bkpt 'bp-data)))" "" \ - "(define (bp-eval-inf-i bkpt) (bp-data-inf-i (gsmob-property bkpt 'bp-data)))" "" \ + "(define (bp-eval-count bkpt) (bp-data-count (gdb-object-property bkpt 'bp-data)))" "" \ + "(define (bp-eval-inf-i bkpt) (bp-data-inf-i (gdb-object-property bkpt 'bp-data)))" "" \ "(define (make-bp-eval location)" "" \ " (let ((bp (create-breakpoint! location)))" "" \ - " (set-gsmob-property! bp 'bp-data (make-bp-data))" "" \ + " (set-gdb-object-property! bp 'bp-data (make-bp-data))" "" \ " (set-breakpoint-stop! bp" "" \ " (lambda (bkpt)" "" \ - " (let ((data (gsmob-property bkpt 'bp-data))" "" \ + " (let ((data (gdb-object-property bkpt 'bp-data))" "" \ " (inf-i (parse-and-eval \"i\")))" "" \ " (set-bp-data-count! data (+ (bp-data-count data) 1))" "" \ " (set-bp-data-inf-i! data inf-i)" "" \ @@ -329,10 +329,10 @@ proc test_bkpt_eval_funcs { } { "guile" "" \ "(define (make-bp-also-eval location)" "" \ " (let ((bp (create-breakpoint! location)))" "" \ - " (set-gsmob-property! bp 'bp-data (make-bp-data))" "" \ + " (set-gdb-object-property! bp 'bp-data (make-bp-data))" "" \ " (set-breakpoint-stop! bp" "" \ " (lambda (bkpt)" "" \ - " (let* ((data (gsmob-property bkpt 'bp-data))" "" \ + " (let* ((data (gdb-object-property bkpt 'bp-data))" "" \ " (count (+ (bp-data-count data) 1)))" "" \ " (set-bp-data-count! data count)" "" \ " (= count 9))))" "" \ @@ -343,7 +343,7 @@ proc test_bkpt_eval_funcs { } { "guile" "" \ "(define (make-bp-basic location)" "" \ " (let ((bp (create-breakpoint! location)))" "" \ - " (set-gsmob-property! bp 'bp-data (make-bp-data))" "" \ + " (set-gdb-object-property! bp 'bp-data (make-bp-data))" "" \ " bp))" "" \ "end" "" diff --git a/gdb/testsuite/gdb.guile/scm-gsmob.exp b/gdb/testsuite/gdb.guile/scm-gsmob.exp index 470afc4..e33d0e1 100644 --- a/gdb/testsuite/gdb.guile/scm-gsmob.exp +++ b/gdb/testsuite/gdb.guile/scm-gsmob.exp @@ -45,17 +45,17 @@ proc prop_name { i } { # Set and ref the properties in separate loops to verify previously set # properties are not lost when we set a new property or switch to htabs. for {set i 0} {$i <= $SMOB_PROP_HTAB_THRESHOLD} {incr i} { - gdb_test "gu (print (gsmob-has-property? arch '[prop_name $i]))" \ + gdb_test "gu (print (gdb-object-has-property? arch '[prop_name $i]))" \ "= #f" "property prop$i not present before set" - gdb_test_no_output "gu (set-gsmob-property! arch '[prop_name $i] $i)" \ + gdb_test_no_output "gu (set-gdb-object-property! arch '[prop_name $i] $i)" \ "set prop $i" - gdb_test "gu (print (gsmob-has-property? arch '[prop_name $i]))" \ + gdb_test "gu (print (gdb-object-has-property? arch '[prop_name $i]))" \ "= #t" "property prop$i present after set" } for {set i 0} {$i <= $SMOB_PROP_HTAB_THRESHOLD} {incr i} { - gdb_test "gu (print (gsmob-has-property? arch '[prop_name $i]))" \ + gdb_test "gu (print (gdb-object-has-property? arch '[prop_name $i]))" \ "= #t" "property prop$i present after all set" - gdb_test "gu (print (gsmob-property arch '[prop_name $i]))" \ + gdb_test "gu (print (gdb-object-property arch '[prop_name $i]))" \ "= $i" "ref prop $i" } @@ -66,5 +66,5 @@ for {set i 0} {$i <= $SMOB_PROP_HTAB_THRESHOLD} {incr i} { } set prop_list [lsort $prop_list] verbose -log "prop_list: $prop_list" -gdb_test "gu (print (sort (gsmob-properties arch) (lambda (a b) (stringstring a) (symbol->string b)))))" \ - "= \\($prop_list\\)" "gsmob-properties" +gdb_test "gu (print (sort (gdb-object-properties arch) (lambda (a b) (stringstring a) (symbol->string b)))))" \ + "= \\($prop_list\\)" "gdb-object-properties"