* [PATCH 3/8] Fix typos in documentation of Guile `execute' function
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:35 ` Eli Zaretskii
2014-04-09 16:09 ` [PATCH 2/8] Fix excess parentheses in Guile extension examples Andy Wingo
` (14 subsequent siblings)
15 siblings, 1 reply; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/doc/guile.texi (Basic Guile): Fix some typos.
---
gdb/doc/guile.texi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi
index 7d4d098..3f6580e 100644
--- a/gdb/doc/guile.texi
+++ b/gdb/doc/guile.texi
@@ -238,7 +238,7 @@ int
The @code{(gdb)} module provides these basic Guile functions.
@c TODO: line length
-@deffn {Scheme Procedure} execute command @r{[}#:from-tty boolean@r{]}@r{[}#:to-string boolean@r{]}
+@deffn {Scheme Procedure} execute command @r{[}#:from-tty boolean@r{]} @r{[}#:to-string boolean@r{]}
Evaluate @var{command}, a string, as a @value{GDBN} CLI command.
If a @value{GDBN} exception happens while @var{command} runs, it is
translated as described in
@@ -251,7 +251,7 @@ It must be a boolean value. If omitted, it defaults to @code{#f}.
By default, any output produced by @var{command} is sent to
@value{GDBN}'s standard output (and to the log output if logging is
turned on). If the @var{to-string} parameter is
-@code{#t}, then output will be collected by @code{gdb.execute} and
+@code{#t}, then output will be collected by @code{execute} and
returned as a string. The default is @code{#f}, in which case the
return value is unspecified. If @var{to-string} is @code{#t}, the
@value{GDBN} virtual terminal will be temporarily set to unlimited width
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 2/8] Fix excess parentheses in Guile extension examples.
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
2014-04-09 16:09 ` [PATCH 3/8] Fix typos in documentation of Guile `execute' function Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:33 ` Eli Zaretskii
2014-04-09 16:09 ` [PATCH 4/9] Fix typos in documentation of Guile `execute' function Andy Wingo
` (13 subsequent siblings)
15 siblings, 1 reply; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/doc/guile.texi (Writing a Guile Pretty-Printer):
(Guile Types Module): Fix excess parentheses in use-modules forms.
---
gdb/doc/guile.texi | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi
index 56d817e..7d4d098 100644
--- a/gdb/doc/guile.texi
+++ b/gdb/doc/guile.texi
@@ -1600,7 +1600,7 @@ To continue the @code{my::string} example,
this code might appear in @code{(my-project my-library v1)}:
@smallexample
-(use-modules ((gdb)))
+(use-modules (gdb))
(define (register-printers objfile)
(append-objfile-pretty-printer!
(make-pretty-printer "my-string" str-lookup-function)))
@@ -1610,7 +1610,7 @@ this code might appear in @code{(my-project my-library v1)}:
And then the corresponding contents of the auto-load file would be:
@smallexample
-(use-modules ((gdb) (my-project my-library v1)))
+(use-modules (gdb) (my-project my-library v1))
(register-printers (current-objfile))
@end smallexample
@@ -1661,7 +1661,7 @@ This example doesn't need a lookup function, that is handled by the
the object that handles the lookup.
@smallexample
-(use-modules ((gdb printing)))
+(use-modules (gdb printing))
(define (build-pretty-printer)
(let ((pp (make-pretty-printer-collection "my-library")))
@@ -1673,7 +1673,7 @@ the object that handles the lookup.
And here is the autoload support:
@smallexample
-(use-modules ((gdb) (my-library)))
+(use-modules (gdb) (my-library))
(append-objfile-pretty-printer! (current-objfile) (build-pretty-printer))
@end smallexample
@@ -3264,7 +3264,7 @@ Then in gdb:
@smallexample
(gdb) start
-(gdb) guile (use-modules ((gdb) (gdb types)))
+(gdb) guile (use-modules (gdb) (gdb types))
(gdb) guile (define foo-ref (parse-and-eval "foo_ref"))
(gdb) guile (get-basic-type (value-type foo-ref))
int
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/8] Fix excess parentheses in Guile extension examples.
2014-04-09 16:09 ` [PATCH 2/8] Fix excess parentheses in Guile extension examples Andy Wingo
@ 2014-04-09 16:33 ` Eli Zaretskii
0 siblings, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2014-04-09 16:33 UTC (permalink / raw)
To: Andy Wingo; +Cc: gdb-patches, wingo
> From: Andy Wingo <wingo@igalia.com>
> Cc: Andy Wingo <wingo@igalia.com>
> Date: Wed, 9 Apr 2014 18:08:32 +0200
>
> * gdb/doc/guile.texi (Writing a Guile Pretty-Printer):
> (Guile Types Module): Fix excess parentheses in use-modules forms.
This part is OK, but the colon on the first line of the ChangeLog
should not be there, and please modify doc/ChangeLog, not
gdb/ChangeLog (which will remove the need for leading directories in
the file name).
Thanks.
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 4/9] Fix typos in documentation of Guile `execute' function
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
2014-04-09 16:09 ` [PATCH 3/8] Fix typos in documentation of Guile `execute' function Andy Wingo
2014-04-09 16:09 ` [PATCH 2/8] Fix excess parentheses in Guile extension examples Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:09 ` [PATCH 2/9] Define and export Guile classes for all GDB object types Andy Wingo
` (12 subsequent siblings)
15 siblings, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/doc/guile.texi (Basic Guile): Fix some typos.
---
gdb/doc/guile.texi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi
index 7d4d098..3f6580e 100644
--- a/gdb/doc/guile.texi
+++ b/gdb/doc/guile.texi
@@ -238,7 +238,7 @@ int
The @code{(gdb)} module provides these basic Guile functions.
@c TODO: line length
-@deffn {Scheme Procedure} execute command @r{[}#:from-tty boolean@r{]}@r{[}#:to-string boolean@r{]}
+@deffn {Scheme Procedure} execute command @r{[}#:from-tty boolean@r{]} @r{[}#:to-string boolean@r{]}
Evaluate @var{command}, a string, as a @value{GDBN} CLI command.
If a @value{GDBN} exception happens while @var{command} runs, it is
translated as described in
@@ -251,7 +251,7 @@ It must be a boolean value. If omitted, it defaults to @code{#f}.
By default, any output produced by @var{command} is sent to
@value{GDBN}'s standard output (and to the log output if logging is
turned on). If the @var{to-string} parameter is
-@code{#t}, then output will be collected by @code{gdb.execute} and
+@code{#t}, then output will be collected by @code{execute} and
returned as a string. The default is @code{#f}, in which case the
return value is unspecified. If @var{to-string} is @code{#t}, the
@value{GDBN} virtual terminal will be temporarily set to unlimited width
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 2/9] Define and export Guile classes for all GDB object types
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
` (2 preceding siblings ...)
2014-04-09 16:09 ` [PATCH 4/9] Fix typos in documentation of Guile `execute' function Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:09 ` [PATCH 5/8] Remove Guile GDB object property mechanism Andy Wingo
` (11 subsequent siblings)
15 siblings, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* 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
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 5/8] Remove Guile GDB object property mechanism
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
` (3 preceding siblings ...)
2014-04-09 16:09 ` [PATCH 2/9] Define and export Guile classes for all GDB object types Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:37 ` Eli Zaretskii
2014-04-09 16:09 ` [PATCH 9/9] Remove a useless Guile finalizer Andy Wingo
` (10 subsequent siblings)
15 siblings, 1 reply; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/guile/guile-internal.h: Remove scm_gsmob / GDB_SMOB_HEAD base
type; it only served as something to which object properties could be
attached: a use case already served by Guile's own object properties.
(gdbscm_init_gsmob, gdbscm_mark_gsmob, gdbscm_mark_chained_gsmob)
(gdbscm_mark_eqable_gsmob): Remove these now-unneeded functions.
* gdb/guile/scm-gsmob.c (gdbscm_init_gsmob, gdbscm_mark_gsmob)
(gdbscm_mark_chained_gsmob, gdbscm_mark_eqable_gsmob): Remove.
(gdbscm_gsmob_property, gdbscm_set_gsmob_property_x)
(gdbscm_gsmob_has_property_p, add_property_name)
(gdbscm_gsmob_properties): Remove these public interfaces, and remove
them from gsmob_functions.
* gdb/guile/scm-arch.c:
* gdb/guile/scm-block.c:
* gdb/guile/scm-breakpoint.c:
* gdb/guile/scm-exception.c:
* gdb/guile/scm-frame.c:
* gdb/guile/scm-iterator.c:
* gdb/guile/scm-lazy-string.c:
* gdb/guile/scm-objfile.c:
* gdb/guile/scm-pretty-print.c:
* gdb/guile/scm-symbol.c:
* gdb/guile/scm-symtab.c:
* gdb/guile/scm-type.c:
* gdb/guile/scm-value.c: Adapt to not include a gdb_gsmob base member,
for basic gsmobs, and to not call init/mark functions.
* gdb/doc/guile.texi (GDB Scheme Data Types): Update.
* gdb/guile/lib/gdb.scm (gdb-object-property, set-gdb-object-property)
(gdb-object-has-property?, gdb-object-properties): Remove.
---
gdb/doc/guile.texi | 27 ------
gdb/guile/guile-internal.h | 43 ++-------
gdb/guile/lib/gdb.scm | 4 -
gdb/guile/scm-arch.c | 9 +-
gdb/guile/scm-block.c | 15 +--
gdb/guile/scm-breakpoint.c | 9 +-
gdb/guile/scm-exception.c | 8 +-
gdb/guile/scm-frame.c | 5 +-
gdb/guile/scm-gsmob.c | 216 ++-----------------------------------------
gdb/guile/scm-iterator.c | 8 +-
gdb/guile/scm-lazy-string.c | 9 +-
gdb/guile/scm-objfile.c | 9 +-
gdb/guile/scm-pretty-print.c | 16 +---
gdb/guile/scm-symbol.c | 5 +-
gdb/guile/scm-symtab.c | 14 +--
gdb/guile/scm-type.c | 13 +--
gdb/guile/scm-value.c | 8 +-
17 files changed, 31 insertions(+), 387 deletions(-)
diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi
index f7204e9..be3176b 100644
--- a/gdb/doc/guile.texi
+++ b/gdb/doc/guile.texi
@@ -342,33 +342,6 @@ Return the kind of the @value{GDBN} object, e.g., @code{<gdb:breakpoint>},
as a symbol.
@end deffn
-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-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} 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} 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} gdb-object-properties object
-Return an unsorted list of names of properties.
-@end deffn
-
@value{GDBN} defines the following object types:
@table @code
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index f95f092..bc3f55d 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -155,42 +155,23 @@ extern int gdbscm_is_procedure (SCM proc);
\f
/* GDB smobs, from scm-smob.c */
-/* All gdb smobs must contain one of the following as the first member:
- gdb_smob, chained_gdb_smob, or eqable_gdb_smob.
+/* Chained GDB smobs should have chained_gdb_smob as their first member. The
+ next,prev members of chained_gdb_smob allow for chaining gsmobs together so
+ that, for example, when an objfile is deleted we can clean up all smobs that
+ reference it.
- The next,prev members of chained_gdb_smob allow for chaining gsmobs
- together so that, for example, when an objfile is deleted we can clean up
- all smobs that reference it.
-
- The containing_scm member of eqable_gdb_smob allows for returning the
- same gsmob instead of creating a new one, allowing them to be eq?-able.
-
- IMPORTANT: chained_gdb_smob and eqable_gdb-smob are a "subclasses" of
- gdb_smob. The layout of chained_gdb_smob,eqable_gdb_smob must match
- gdb_smob as if it is a subclass. To that end we use macro GDB_SMOB_HEAD
- to ensure this. */
-
-#define GDB_SMOB_HEAD \
- /* Property list for externally added fields. */ \
- SCM properties;
-
-typedef struct
-{
- GDB_SMOB_HEAD
-} gdb_smob;
+ Eq-able GDB smobs should have eqable_gdb_smob as their first member. The
+ containing_scm member of eqable_gdb_smob allows for returning the same gsmob
+ instead of creating a new one, allowing them to be eq?-able. */
typedef struct _chained_gdb_smob
{
- GDB_SMOB_HEAD
-
struct _chained_gdb_smob *prev;
struct _chained_gdb_smob *next;
} chained_gdb_smob;
typedef struct _eqable_gdb_smob
{
- GDB_SMOB_HEAD
-
/* The object we are contained in.
This can be used for several purposes.
This is used by the eq? machinery: We need to be able to see if we have
@@ -204,8 +185,6 @@ typedef struct _eqable_gdb_smob
SCM containing_scm;
} eqable_gdb_smob;
-#undef GDB_SMOB_HEAD
-
struct objfile;
struct objfile_data;
@@ -215,19 +194,11 @@ typedef int (gsmob_pred_func) (SCM);
extern scm_t_bits gdbscm_make_smob_type (const char *name, size_t size);
-extern void gdbscm_init_gsmob (gdb_smob *base);
-
extern void gdbscm_init_chained_gsmob (chained_gdb_smob *base);
extern void gdbscm_init_eqable_gsmob (eqable_gdb_smob *base,
SCM containing_scm);
-extern SCM gdbscm_mark_gsmob (gdb_smob *base);
-
-extern SCM gdbscm_mark_chained_gsmob (chained_gdb_smob *base);
-
-extern SCM gdbscm_mark_eqable_gsmob (eqable_gdb_smob *base);
-
extern void gdbscm_add_objfile_ref (struct objfile *objfile,
const struct objfile_data *data_key,
chained_gdb_smob *g_smob);
diff --git a/gdb/guile/lib/gdb.scm b/gdb/guile/lib/gdb.scm
index 57d6472..ec739c7 100644
--- a/gdb/guile/lib/gdb.scm
+++ b/gdb/guile/lib/gdb.scm
@@ -273,10 +273,6 @@
;; scm-gsmob.c
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-arch.c b/gdb/guile/scm-arch.c
index fa578f3..6a805c6 100644
--- a/gdb/guile/scm-arch.c
+++ b/gdb/guile/scm-arch.c
@@ -31,9 +31,6 @@
struct _arch_smob
{
- /* This always appears first. */
- gdb_smob base;
-
struct gdbarch *gdbarch;
};
@@ -53,10 +50,7 @@ static int arscm_is_arch (SCM);
static SCM
arscm_mark_arch_smob (SCM self)
{
- arch_smob *a_smob = (arch_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_gsmob (&a_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "print" function for <gdb:arch>. */
@@ -88,7 +82,6 @@ arscm_make_arch_smob (struct gdbarch *gdbarch)
a_smob->gdbarch = gdbarch;
a_scm = scm_new_smob (arch_smob_tag, (scm_t_bits) a_smob);
- gdbscm_init_gsmob (&a_smob->base);
return a_scm;
}
diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c
index 4e1748e..8f39e7c 100644
--- a/gdb/guile/scm-block.c
+++ b/gdb/guile/scm-block.c
@@ -56,9 +56,6 @@ typedef struct _block_smob
typedef struct
{
- /* This always appears first. */
- gdb_smob base;
-
/* The iterator for that block. */
struct block_iterator iter;
@@ -125,10 +122,7 @@ bkscm_objfile_block_map (struct objfile *objfile)
static SCM
bkscm_mark_block_smob (SCM self)
{
- block_smob *b_smob = (block_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_eqable_gsmob (&b_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "free" function for <gdb:block>. */
@@ -540,11 +534,7 @@ gdbscm_block_symbols (SCM self)
static SCM
bkscm_mark_block_syms_progress_smob (SCM self)
{
- block_syms_progress_smob *i_smob
- = (block_syms_progress_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_gsmob (&i_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "print" function for <gdb:block-symbols-iterator>. */
@@ -607,7 +597,6 @@ bkscm_make_block_syms_progress_smob (void)
memset (&i_smob->iter, 0, sizeof (i_smob->iter));
i_smob->initialized_p = 0;
smob = scm_new_smob (block_syms_progress_smob_tag, (scm_t_bits) i_smob);
- gdbscm_init_gsmob (&i_smob->base);
return smob;
}
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index d022377..a66b82e 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -38,9 +38,6 @@
typedef struct gdbscm_breakpoint_object
{
- /* This always appears first. */
- gdb_smob base;
-
/* The breakpoint number according to gdb.
This is recorded here because BP will be NULL when deleted. */
int number;
@@ -83,10 +80,7 @@ bpscm_mark_breakpoint_smob (SCM self)
/* We don't mark containing_scm here. It is just a backlink to our
container, and is gc'protected until the breakpoint is deleted. */
- scm_gc_mark (bp_smob->stop);
-
- /* Do this last. */
- return gdbscm_mark_gsmob (&bp_smob->base);
+ return bp_smob->stop;
}
/* The smob "free" function for <gdb:breakpoint>. */
@@ -192,7 +186,6 @@ bpscm_make_breakpoint_smob (void)
bp_smob->stop = SCM_BOOL_F;
bp_scm = scm_new_smob (breakpoint_smob_tag, (scm_t_bits) bp_smob);
bp_smob->containing_scm = bp_scm;
- gdbscm_init_gsmob (&bp_smob->base);
return bp_scm;
}
diff --git a/gdb/guile/scm-exception.c b/gdb/guile/scm-exception.c
index a96a350..316f0b4 100644
--- a/gdb/guile/scm-exception.c
+++ b/gdb/guile/scm-exception.c
@@ -40,9 +40,6 @@
typedef struct
{
- /* This always appears first. */
- gdb_smob base;
-
/* The key and args parameters to "throw". */
SCM key;
SCM args;
@@ -109,9 +106,7 @@ exscm_mark_exception_smob (SCM self)
exception_smob *e_smob = (exception_smob *) SCM_SMOB_DATA (self);
scm_gc_mark (e_smob->key);
- scm_gc_mark (e_smob->args);
- /* Do this last. */
- return gdbscm_mark_gsmob (&e_smob->base);
+ return e_smob->args;
}
/* The smob "print" function for <gdb:exception>. */
@@ -145,7 +140,6 @@ gdbscm_make_exception (SCM key, SCM args)
e_smob->key = key;
e_smob->args = args;
smob = scm_new_smob (exception_smob_tag, (scm_t_bits) e_smob);
- gdbscm_init_gsmob (&e_smob->base);
++gdbscm_exception_count;
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index 6031a7f..ee30597 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -135,10 +135,7 @@ frscm_inferior_frame_map (struct inferior *inferior)
static SCM
frscm_mark_frame_smob (SCM self)
{
- frame_smob *f_smob = (frame_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_eqable_gsmob (&f_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "free" function for <gdb:frame>. */
diff --git a/gdb/guile/scm-gsmob.c b/gdb/guile/scm-gsmob.c
index 4ba9770..79dc9309 100644
--- a/gdb/guile/scm-gsmob.c
+++ b/gdb/guile/scm-gsmob.c
@@ -30,25 +30,16 @@
specify the gdb smob kind, that is left for another day if it ever is
needed.
- We want the objects we export to Scheme to be extensible by the user.
- A gsmob (gdb smob) adds a simple API on top of smobs to support this.
- This allows GDB objects to be easily extendable in a useful manner.
- To that end, all smobs in gdb have gdb_smob as the first member.
-
- On top of gsmobs there are "chained gsmobs". They are used to assist with
- life-time tracking of GDB objects vs Scheme objects. Gsmobs can "subclass"
+ Some GDB smobs are "chained gsmobs". They are used to assist with life-time
+ tracking of GDB objects vs Scheme objects. Gsmobs can "subclass"
chained_gdb_smob, which contains a doubly-linked list to assist with
life-time tracking.
- On top of gsmobs there are also "eqable gsmobs". Gsmobs can "subclass"
- eqable_gdb_smob instead of gdb_smob, and is used to make gsmobs eq?-able.
- This is done by recording all gsmobs in a hash table and before creating a
- gsmob first seeing if it's already in the table. Eqable gsmobs can also be
- used where lifetime-tracking is required.
-
- 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-gdb-object-property!, gdb-object-property. */
+ Some other GDB smobs are "eqable gsmobs". Gsmob implementations can
+ "subclass" eqable_gdb_smob to make gsmobs eq?-able. This is done by
+ recording all gsmobs in a hash table and before creating a gsmob first seeing
+ if it's already in the table. Eqable gsmobs can also be used where
+ lifetime-tracking is required. */
#include "defs.h"
#include "hashtab.h"
@@ -61,15 +52,6 @@
static htab_t registered_gsmobs;
-/* Gsmob properties are initialize stored as an alist to minimize space
- usage: GDB can be used to debug some really big programs, and property
- lists generally have very few elements. Once the list grows to this
- many elements then we switch to a hash table.
- The smallest Guile hashtable in 2.0 uses a vector of 31 elements.
- The value we use here is large enough to hold several expected uses,
- without being so large that we might as well just use a hashtable. */
-#define SMOB_PROP_HTAB_THRESHOLD 7
-
/* Hash function for registered_gsmobs hash table. */
static hashval_t
@@ -126,14 +108,6 @@ gdbscm_make_smob_type (const char *name, size_t size)
return result;
}
-/* Initialize a gsmob. */
-
-void
-gdbscm_init_gsmob (gdb_smob *base)
-{
- base->properties = SCM_EOL;
-}
-
/* Initialize a chained_gdb_smob.
This is the same as gdbscm_init_gsmob except that it also sets prev,next
to NULL. */
@@ -141,7 +115,6 @@ gdbscm_init_gsmob (gdb_smob *base)
void
gdbscm_init_chained_gsmob (chained_gdb_smob *base)
{
- gdbscm_init_gsmob ((gdb_smob *) base);
base->prev = NULL;
base->next = NULL;
}
@@ -153,50 +126,9 @@ gdbscm_init_chained_gsmob (chained_gdb_smob *base)
void
gdbscm_init_eqable_gsmob (eqable_gdb_smob *base, SCM containing_scm)
{
- gdbscm_init_gsmob ((gdb_smob *) base);
base->containing_scm = containing_scm;
}
-/* Call this from each smob's "mark" routine.
- In general, this should be called as:
- return gdbscm_mark_gsmob (base); */
-
-SCM
-gdbscm_mark_gsmob (gdb_smob *base)
-{
- /* Return the last one to mark as an optimization.
- The marking infrastructure will mark it for us. */
- return base->properties;
-}
-
-/* Call this from each smob's "mark" routine.
- In general, this should be called as:
- return gdbscm_mark_chained_gsmob (base); */
-
-SCM
-gdbscm_mark_chained_gsmob (chained_gdb_smob *base)
-{
- /* Return the last one to mark as an optimization.
- The marking infrastructure will mark it for us. */
- return base->properties;
-}
-
-/* Call this from each smob's "mark" routine.
- In general, this should be called as:
- return gdbscm_mark_eqable_gsmob (base); */
-
-SCM
-gdbscm_mark_eqable_gsmob (eqable_gdb_smob *base)
-{
- /* There's no need to mark containing_scm.
- Any references to it either come from Scheme in which case it will be
- marked through them, or there's a reference to the smob from gdb in
- which case the smob is GC-protected. */
-
- /* Return the last one to mark as an optimization.
- The marking infrastructure will mark it for us. */
- return base->properties;
-}
\f
/* gsmob accessors */
@@ -236,124 +168,6 @@ gdbscm_gsmob_kind (SCM self)
return result;
}
-/* (gdb-object-property gsmob property) -> object
- If property isn't present then #f is returned. */
-
-static SCM
-gdbscm_gsmob_property (SCM self, SCM property)
-{
- SCM smob;
- gdb_smob *base;
-
- smob = gsscm_get_gsmob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- base = (gdb_smob *) SCM_SMOB_DATA (self);
-
- /* Have we switched to a hash table? */
- if (gdbscm_is_true (scm_hash_table_p (base->properties)))
- return scm_hashq_ref (base->properties, property, SCM_BOOL_F);
-
- return scm_assq_ref (base->properties, property);
-}
-
-/* (set-gdb-object-property! gsmob property new-value) -> unspecified */
-
-static SCM
-gdbscm_set_gsmob_property_x (SCM self, SCM property, SCM new_value)
-{
- SCM smob, alist;
- gdb_smob *base;
-
- smob = gsscm_get_gsmob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- base = (gdb_smob *) SCM_SMOB_DATA (self);
-
- /* Have we switched to a hash table? */
- if (gdbscm_is_true (scm_hash_table_p (base->properties)))
- {
- scm_hashq_set_x (base->properties, property, new_value);
- return SCM_UNSPECIFIED;
- }
-
- alist = scm_assq_set_x (base->properties, property, new_value);
-
- /* Did we grow the list? */
- if (!scm_is_eq (alist, base->properties))
- {
- /* If we grew the list beyond a threshold in size,
- switch to a hash table. */
- if (scm_ilength (alist) >= SMOB_PROP_HTAB_THRESHOLD)
- {
- SCM elm, htab;
-
- htab = scm_c_make_hash_table (SMOB_PROP_HTAB_THRESHOLD);
- for (elm = alist; elm != SCM_EOL; elm = scm_cdr (elm))
- scm_hashq_set_x (htab, scm_caar (elm), scm_cdar (elm));
- base->properties = htab;
- return SCM_UNSPECIFIED;
- }
- }
-
- base->properties = alist;
- return SCM_UNSPECIFIED;
-}
-
-/* (gdb-object-has-property? gsmob property) -> boolean */
-
-static SCM
-gdbscm_gsmob_has_property_p (SCM self, SCM property)
-{
- SCM smob, handle;
- gdb_smob *base;
-
- smob = gsscm_get_gsmob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- base = (gdb_smob *) SCM_SMOB_DATA (self);
-
- if (gdbscm_is_true (scm_hash_table_p (base->properties)))
- handle = scm_hashq_get_handle (base->properties, property);
- else
- handle = scm_assq (property, base->properties);
-
- return scm_from_bool (gdbscm_is_true (handle));
-}
-
-/* Helper function for gdbscm_gsmob_properties. */
-
-static SCM
-add_property_name (void *closure, SCM handle)
-{
- SCM *resultp = closure;
-
- *resultp = scm_cons (scm_car (handle), *resultp);
- return SCM_UNSPECIFIED;
-}
-
-/* (gdb-object-properties gsmob) -> list
- The list is unsorted. */
-
-static SCM
-gdbscm_gsmob_properties (SCM self)
-{
- SCM smob, handle, result;
- gdb_smob *base;
-
- smob = gsscm_get_gsmob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- base = (gdb_smob *) SCM_SMOB_DATA (self);
-
- result = SCM_EOL;
- if (gdbscm_is_true (scm_hash_table_p (base->properties)))
- {
- scm_internal_hash_for_each_handle (add_property_name, &result,
- base->properties);
- }
- else
- {
- SCM elm;
-
- for (elm = base->properties; elm != SCM_EOL; elm = scm_cdr (elm))
- result = scm_cons (scm_caar (elm), result);
- }
-
- return result;
-}
\f
/* When underlying gdb data structures are deleted, we need to update any
smobs with references to them. There are several smobs that reference
@@ -453,22 +267,6 @@ static const scheme_function gsmob_functions[] =
"\
Return the kind of the GDB object, e.g., <gdb:breakpoint>, as a symbol." },
- { "gdb-object-property", 2, 0, 0, gdbscm_gsmob_property,
- "\
-Return the specified property of the GDB object." },
-
- { "set-gdb-object-property!", 3, 0, 0, gdbscm_set_gsmob_property_x,
- "\
-Set the specified property of the GDB object." },
-
- { "gdb-object-has-property?", 2, 0, 0, gdbscm_gsmob_has_property_p,
- "\
-Return #t if the specified property is present." },
-
- { "gdb-object-properties", 1, 0, 0, gdbscm_gsmob_properties,
- "\
-Return an unsorted list of names of properties." },
-
END_FUNCTIONS
};
diff --git a/gdb/guile/scm-iterator.c b/gdb/guile/scm-iterator.c
index a6deb84..080339b 100644
--- a/gdb/guile/scm-iterator.c
+++ b/gdb/guile/scm-iterator.c
@@ -60,9 +60,6 @@
struct _iterator_smob
{
- /* This always appears first. */
- gdb_smob base;
-
/* The object being iterated over. */
SCM object;
@@ -119,9 +116,7 @@ itscm_mark_iterator_smob (SCM self)
scm_gc_mark (i_smob->object);
scm_gc_mark (i_smob->progress);
- scm_gc_mark (i_smob->next_x);
- /* Do this last. */
- return gdbscm_mark_gsmob (&i_smob->base);
+ return i_smob->next_x;
}
/* The smob "print" function for <gdb:iterator>. */
@@ -160,7 +155,6 @@ itscm_make_iterator_smob (SCM object, SCM progress, SCM next)
i_smob->progress = progress;
i_smob->next_x = next;
i_scm = scm_new_smob (iterator_smob_tag, (scm_t_bits) i_smob);
- gdbscm_init_gsmob (&i_smob->base);
return i_scm;
}
diff --git a/gdb/guile/scm-lazy-string.c b/gdb/guile/scm-lazy-string.c
index e965d01..9409379 100644
--- a/gdb/guile/scm-lazy-string.c
+++ b/gdb/guile/scm-lazy-string.c
@@ -33,9 +33,6 @@
typedef struct
{
- /* This always appears first. */
- gdb_smob base;
-
/* Holds the address of the lazy string. */
CORE_ADDR address;
@@ -68,10 +65,7 @@ static scm_t_bits lazy_string_smob_tag;
static SCM
lsscm_mark_lazy_string_smob (SCM self)
{
- lazy_string_smob *ls_smob = (lazy_string_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_gsmob (&ls_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "free" function for <gdb:lazy-string>. */
@@ -132,7 +126,6 @@ lsscm_make_lazy_string_smob (CORE_ADDR address, int length,
ls_smob->type = type;
ls_scm = scm_new_smob (lazy_string_smob_tag, (scm_t_bits) ls_smob);
- gdbscm_init_gsmob (&ls_smob->base);
return ls_scm;
}
diff --git a/gdb/guile/scm-objfile.c b/gdb/guile/scm-objfile.c
index 70f7e33..693d404 100644
--- a/gdb/guile/scm-objfile.c
+++ b/gdb/guile/scm-objfile.c
@@ -30,9 +30,6 @@
struct _objfile_smob
{
- /* This always appears first. */
- gdb_smob base;
-
/* The corresponding objfile. */
struct objfile *objfile;
@@ -69,13 +66,10 @@ ofscm_mark_objfile_smob (SCM self)
{
objfile_smob *o_smob = (objfile_smob *) SCM_SMOB_DATA (self);
- scm_gc_mark (o_smob->pretty_printers);
-
/* We don't mark containing_scm here. It is just a backlink to our
container, and is gc-protected until the objfile is deleted. */
- /* Do this last. */
- return gdbscm_mark_gsmob (&o_smob->base);
+ return o_smob->pretty_printers;
}
/* The smob "print" function for <gdb:objfile>. */
@@ -113,7 +107,6 @@ ofscm_make_objfile_smob (void)
o_smob->pretty_printers = SCM_EOL;
o_scm = scm_new_smob (objfile_smob_tag, (scm_t_bits) o_smob);
o_smob->containing_scm = o_scm;
- gdbscm_init_gsmob (&o_smob->base);
return o_scm;
}
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index 1b9902f4..f25eac3 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -62,9 +62,6 @@ enum display_hint
typedef struct
{
- /* This must appear first. */
- gdb_smob base;
-
/* A string representing the name of the printer. */
SCM name;
@@ -84,9 +81,6 @@ typedef struct
typedef struct
{
- /* This must appear first. */
- gdb_smob base;
-
/* Either #f or one of the supported display hints: map, array, string.
If neither of those then the display hint is ignored (treated as #f). */
SCM display_hint;
@@ -136,9 +130,7 @@ ppscm_mark_pretty_printer_smob (SCM self)
scm_gc_mark (pp_smob->name);
scm_gc_mark (pp_smob->enabled);
- scm_gc_mark (pp_smob->lookup);
- /* Do this last. */
- return gdbscm_mark_gsmob (&pp_smob->base);
+ return pp_smob->lookup;
}
/* The smob "print" function for <gdb:pretty-printer>. */
@@ -179,7 +171,6 @@ gdbscm_make_pretty_printer (SCM name, SCM lookup)
pp_smob->lookup = lookup;
pp_smob->enabled = SCM_BOOL_T;
smob = scm_new_smob (pretty_printer_smob_tag, (scm_t_bits) pp_smob);
- gdbscm_init_gsmob (&pp_smob->base);
return smob;
}
@@ -267,9 +258,7 @@ ppscm_mark_pretty_printer_worker_smob (SCM self)
scm_gc_mark (w_smob->display_hint);
scm_gc_mark (w_smob->to_string);
- scm_gc_mark (w_smob->children);
- /* Do this last. */
- return gdbscm_mark_gsmob (&w_smob->base);
+ return w_smob->children;
}
/* The smob "print" function for <gdb:pretty-printer-worker>. */
@@ -311,7 +300,6 @@ gdbscm_make_pretty_printer_worker (SCM display_hint, SCM to_string,
w_smob->to_string = to_string;
w_smob->children = children;
w_scm = scm_new_smob (pretty_printer_worker_smob_tag, (scm_t_bits) w_smob);
- gdbscm_init_gsmob (&w_smob->base);
return w_scm;
}
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index 0c5cc05..b6a92a4 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -100,10 +100,7 @@ syscm_objfile_symbol_map (struct symbol *symbol)
static SCM
syscm_mark_symbol_smob (SCM self)
{
- symbol_smob *s_smob = (symbol_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_eqable_gsmob (&s_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "free" function for <gdb:symbol>. */
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index 7294fea..9c7f51c 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -52,9 +52,6 @@ typedef struct
typedef struct
{
- /* This always appears first. */
- gdb_smob base;
-
/* The <gdb:symtab> object of the symtab.
We store this instead of a pointer to the symtab_smob because it's not
clear GC will know the symtab_smob is referenced by us otherwise, and we
@@ -127,10 +124,7 @@ stscm_objfile_symtab_map (struct symtab *symtab)
static SCM
stscm_mark_symtab_smob (SCM self)
{
- symtab_smob *st_smob = (symtab_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_eqable_gsmob (&st_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "free" function for <gdb:symtab>. */
@@ -407,10 +401,7 @@ stscm_mark_sal_smob (SCM self)
{
sal_smob *s_smob = (sal_smob *) SCM_SMOB_DATA (self);
- scm_gc_mark (s_smob->symtab_scm);
-
- /* Do this last. */
- return gdbscm_mark_gsmob (&s_smob->base);
+ return s_smob->symtab_scm;
}
/* The smob "free" function for <gdb:sal>. */
@@ -458,7 +449,6 @@ stscm_make_sal_smob (void)
s_smob->symtab_scm = SCM_BOOL_F;
memset (&s_smob->sal, 0, sizeof (s_smob->sal));
s_scm = scm_new_smob (sal_smob_tag, (scm_t_bits) s_smob);
- gdbscm_init_gsmob (&s_smob->base);
return s_scm;
}
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 9345c28..b65c06a 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -55,9 +55,6 @@ typedef struct _type_smob
typedef struct
{
- /* This always appears first. */
- gdb_smob base;
-
/* Backlink to the containing <gdb:type> object. */
SCM type_scm;
@@ -186,10 +183,7 @@ tyscm_type_map (struct type *type)
static SCM
tyscm_mark_type_smob (SCM self)
{
- type_smob *t_smob = (type_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_eqable_gsmob (&t_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "free" function for <gdb:type>. */
@@ -422,9 +416,7 @@ tyscm_mark_field_smob (SCM self)
{
field_smob *f_smob = (field_smob *) SCM_SMOB_DATA (self);
- scm_gc_mark (f_smob->type_scm);
- /* Do this last. */
- return gdbscm_mark_gsmob (&f_smob->base);
+ return f_smob->type_scm;
}
/* The smob "print" function for <gdb:field>. */
@@ -458,7 +450,6 @@ tyscm_make_field_smob (SCM type_scm, int field_num)
f_smob->type_scm = type_scm;
f_smob->field_num = field_num;
result = scm_new_smob (field_smob_tag, (scm_t_bits) f_smob);
- gdbscm_init_gsmob (&f_smob->base);
return result;
}
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index 8ca0762..70cc7d0 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -36,9 +36,6 @@
typedef struct _value_smob
{
- /* This always appears first. */
- gdb_smob base;
-
/* Doubly linked list of values in values_in_scheme.
IWBN to use a chained_gdb_smob instead, which is doable, it just requires
a bit more casting than normal. */
@@ -132,9 +129,7 @@ vlscm_mark_value_smob (SCM self)
scm_gc_mark (v_smob->address);
scm_gc_mark (v_smob->type);
- scm_gc_mark (v_smob->dynamic_type);
- /* Do this last. */
- return gdbscm_mark_gsmob (&v_smob->base);
+ return v_smob->dynamic_type;
}
/* The smob "free" function for <gdb:value>. */
@@ -238,7 +233,6 @@ vlscm_make_value_smob (void)
v_smob->dynamic_type = SCM_UNDEFINED;
v_scm = scm_new_smob (value_smob_tag, (scm_t_bits) v_smob);
- gdbscm_init_gsmob (&v_smob->base);
return v_scm;
}
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 5/8] Remove Guile GDB object property mechanism
2014-04-09 16:09 ` [PATCH 5/8] Remove Guile GDB object property mechanism Andy Wingo
@ 2014-04-09 16:37 ` Eli Zaretskii
0 siblings, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2014-04-09 16:37 UTC (permalink / raw)
To: Andy Wingo; +Cc: gdb-patches, wingo
> From: Andy Wingo <wingo@igalia.com>
> Cc: Andy Wingo <wingo@igalia.com>
> Date: Wed, 9 Apr 2014 18:08:37 +0200
>
> * gdb/guile/guile-internal.h: Remove scm_gsmob / GDB_SMOB_HEAD base
> type; it only served as something to which object properties could be
> attached: a use case already served by Guile's own object properties.
> (gdbscm_init_gsmob, gdbscm_mark_gsmob, gdbscm_mark_chained_gsmob)
> (gdbscm_mark_eqable_gsmob): Remove these now-unneeded functions.
>
> * gdb/guile/scm-gsmob.c (gdbscm_init_gsmob, gdbscm_mark_gsmob)
> (gdbscm_mark_chained_gsmob, gdbscm_mark_eqable_gsmob): Remove.
> (gdbscm_gsmob_property, gdbscm_set_gsmob_property_x)
> (gdbscm_gsmob_has_property_p, add_property_name)
> (gdbscm_gsmob_properties): Remove these public interfaces, and remove
> them from gsmob_functions.
>
> * gdb/guile/scm-arch.c:
> * gdb/guile/scm-block.c:
> * gdb/guile/scm-breakpoint.c:
> * gdb/guile/scm-exception.c:
> * gdb/guile/scm-frame.c:
> * gdb/guile/scm-iterator.c:
> * gdb/guile/scm-lazy-string.c:
> * gdb/guile/scm-objfile.c:
> * gdb/guile/scm-pretty-print.c:
> * gdb/guile/scm-symbol.c:
> * gdb/guile/scm-symtab.c:
> * gdb/guile/scm-type.c:
> * gdb/guile/scm-value.c: Adapt to not include a gdb_gsmob base member,
> for basic gsmobs, and to not call init/mark functions.
>
> * gdb/doc/guile.texi (GDB Scheme Data Types): Update.
OK for the documentation part.
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 9/9] Remove a useless Guile finalizer
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
` (4 preceding siblings ...)
2014-04-09 16:09 ` [PATCH 5/8] Remove Guile GDB object property mechanism Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:09 ` [PATCH 4/8] Rename "gsmob" in Guile interface to "gdb object" Andy Wingo
` (9 subsequent siblings)
15 siblings, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/guile/scm-symtab.c (stscm_free_sal_smob): Remove useless free
function. (This was the only useless free function.)
---
gdb/guile/scm-symtab.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index 8910973..876bf64 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -386,19 +386,6 @@ gdbscm_symtab_static_block (SCM self)
\f
/* Administrivia for sal (symtab-and-line) smobs. */
-/* The smob "free" function for <gdb:sal>. */
-
-static size_t
-stscm_free_sal_smob (SCM self)
-{
- sal_smob *s_smob = (sal_smob *) SCM_SMOB_DATA (self);
-
- /* Not necessary, done to catch bugs. */
- s_smob->symtab_scm = SCM_UNDEFINED;
-
- return 0;
-}
-
/* The smob "print" function for <gdb:sal>. */
static int
@@ -692,7 +679,6 @@ gdbscm_initialize_symtabs (void)
scm_set_smob_print (symtab_smob_tag, stscm_print_symtab_smob);
sal_smob_tag = gdbscm_make_smob_type (sal_smob_name, sizeof (sal_smob));
- scm_set_smob_free (sal_smob_tag, stscm_free_sal_smob);
scm_set_smob_print (sal_smob_tag, stscm_print_sal_smob);
gdbscm_define_functions (symtab_functions, 1);
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 4/8] Rename "gsmob" in Guile interface to "gdb object"
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
` (5 preceding siblings ...)
2014-04-09 16:09 ` [PATCH 9/9] Remove a useless Guile finalizer Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:36 ` Eli Zaretskii
2014-04-09 16:09 ` [PATCH 8/8] Remove a useless Guile finalizer Andy Wingo
` (8 subsequent siblings)
15 siblings, 1 reply; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/guile/scm-gsmob.c:
* gdb/guile/lib/gdb.scm (gdb-object-kind, gdb-object-property)
(set-gdb-object-property!, gdb-object-has-property?)
(gdb-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/guile.texi (GDB Scheme Data Types): Update the manual.
---
gdb/doc/guile.texi | 37 ++++++++++++++++++-------------------
gdb/guile/lib/gdb.scm | 12 ++++++------
gdb/guile/scm-gsmob.c | 30 +++++++++++++++---------------
3 files changed, 39 insertions(+), 40 deletions(-)
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{<gdb:breakpoint>},
+@deffn {Scheme Procedure} gdb-object-kind object
+Return the kind of the @value{GDBN} object, e.g., @code{<gdb:breakpoint>},
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 <gdb:arch>
@@ -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 <gdb:arch>
diff --git a/gdb/guile/lib/gdb.scm b/gdb/guile/lib/gdb.scm
index f12769e..57d6472 100644
--- a/gdb/guile/lib/gdb.scm
+++ b/gdb/guile/lib/gdb.scm
@@ -270,13 +270,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 b0f9e19..4ba9770 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"
@@ -212,9 +212,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
@@ -236,7 +236,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
@@ -255,7 +255,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)
@@ -296,7 +296,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)
@@ -326,7 +326,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
@@ -449,23 +449,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., <gdb:breakpoint>, as a symbol." },
+Return the kind of the GDB object, e.g., <gdb:breakpoint>, 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." },
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 4/8] Rename "gsmob" in Guile interface to "gdb object"
2014-04-09 16:09 ` [PATCH 4/8] Rename "gsmob" in Guile interface to "gdb object" Andy Wingo
@ 2014-04-09 16:36 ` Eli Zaretskii
0 siblings, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2014-04-09 16:36 UTC (permalink / raw)
To: Andy Wingo; +Cc: gdb-patches, wingo
> From: Andy Wingo <wingo@igalia.com>
> Cc: Andy Wingo <wingo@igalia.com>
> Date: Wed, 9 Apr 2014 18:08:36 +0200
>
> * gdb/guile/scm-gsmob.c:
> * gdb/guile/lib/gdb.scm (gdb-object-kind, gdb-object-property)
> (set-gdb-object-property!, gdb-object-has-property?)
> (gdb-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/guile.texi (GDB Scheme Data Types): Update the manual.
The documentation part is OK (again, ChangeLog entry needs fixing).
Thanks.
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 8/8] Remove a useless Guile finalizer
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
` (6 preceding siblings ...)
2014-04-09 16:09 ` [PATCH 4/8] Rename "gsmob" in Guile interface to "gdb object" Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:09 ` [PATCH 6/8] Remove Guile mark functions that don't mark anything Andy Wingo
` (7 subsequent siblings)
15 siblings, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/guile/scm-symtab.c (stscm_free_sal_smob): Remove useless free
function. (This was the only useless free function.)
---
gdb/guile/scm-symtab.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index 8910973..876bf64 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -386,19 +386,6 @@ gdbscm_symtab_static_block (SCM self)
\f
/* Administrivia for sal (symtab-and-line) smobs. */
-/* The smob "free" function for <gdb:sal>. */
-
-static size_t
-stscm_free_sal_smob (SCM self)
-{
- sal_smob *s_smob = (sal_smob *) SCM_SMOB_DATA (self);
-
- /* Not necessary, done to catch bugs. */
- s_smob->symtab_scm = SCM_UNDEFINED;
-
- return 0;
-}
-
/* The smob "print" function for <gdb:sal>. */
static int
@@ -692,7 +679,6 @@ gdbscm_initialize_symtabs (void)
scm_set_smob_print (symtab_smob_tag, stscm_print_symtab_smob);
sal_smob_tag = gdbscm_make_smob_type (sal_smob_name, sizeof (sal_smob));
- scm_set_smob_free (sal_smob_tag, stscm_free_sal_smob);
scm_set_smob_print (sal_smob_tag, stscm_print_sal_smob);
gdbscm_define_functions (symtab_functions, 1);
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 6/8] Remove Guile mark functions that don't mark anything
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
` (7 preceding siblings ...)
2014-04-09 16:09 ` [PATCH 8/8] Remove a useless Guile finalizer Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:09 ` [PATCH 3/9] Fix excess parentheses in Guile extension examples Andy Wingo
` (6 subsequent siblings)
15 siblings, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/guile/scm-arch.c (arscm_mark_arch_smob):
* gdb/guile/scm-block.c (bkscm_mark_block_smob)
(bkscm_mark_block_syms_progress_smob):
* gdb/guile/scm-frame.c (frscm_mark_frame_smob):
* gdb/guile/scm-lazy-string.c (arscm_mark_arch_smob):
* gdb/guile/scm-symbol.c (lsscm_mark_lazy_string_smob):
* gdb/guile/scm-symtab.c (syscm_mark_symbol_smob):
* gdb/guile/scm-type.c (tyscm_mark_type_smob): Remove useless mark
functions.
---
gdb/guile/scm-arch.c | 9 ---------
gdb/guile/scm-block.c | 19 -------------------
gdb/guile/scm-frame.c | 9 ---------
gdb/guile/scm-lazy-string.c | 9 ---------
gdb/guile/scm-symbol.c | 9 ---------
gdb/guile/scm-symtab.c | 9 ---------
gdb/guile/scm-type.c | 9 ---------
7 files changed, 73 deletions(-)
diff --git a/gdb/guile/scm-arch.c b/gdb/guile/scm-arch.c
index 6a805c6..e4f85bf 100644
--- a/gdb/guile/scm-arch.c
+++ b/gdb/guile/scm-arch.c
@@ -45,14 +45,6 @@ static int arscm_is_arch (SCM);
\f
/* Administrivia for arch smobs. */
-/* The smob "mark" function for <gdb:arch>. */
-
-static SCM
-arscm_mark_arch_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "print" function for <gdb:arch>. */
static int
@@ -651,7 +643,6 @@ void
gdbscm_initialize_arches (void)
{
arch_smob_tag = gdbscm_make_smob_type (arch_smob_name, sizeof (arch_smob));
- scm_set_smob_mark (arch_smob_tag, arscm_mark_arch_smob);
scm_set_smob_print (arch_smob_tag, arscm_print_arch_smob);
gdbscm_define_functions (arch_functions, 1);
diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c
index 8f39e7c..a8a949f 100644
--- a/gdb/guile/scm-block.c
+++ b/gdb/guile/scm-block.c
@@ -117,14 +117,6 @@ bkscm_objfile_block_map (struct objfile *objfile)
return htab;
}
-/* The smob "mark" function for <gdb:block>. */
-
-static SCM
-bkscm_mark_block_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "free" function for <gdb:block>. */
static size_t
@@ -529,14 +521,6 @@ gdbscm_block_symbols (SCM self)
/* The <gdb:block-symbols-iterator> object,
for iterating over all symbols in a block. */
-/* The smob "mark" function for <gdb:block-symbols-iterator>. */
-
-static SCM
-bkscm_mark_block_syms_progress_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "print" function for <gdb:block-symbols-iterator>. */
static int
@@ -787,15 +771,12 @@ gdbscm_initialize_blocks (void)
{
block_smob_tag
= gdbscm_make_smob_type (block_smob_name, sizeof (block_smob));
- scm_set_smob_mark (block_smob_tag, bkscm_mark_block_smob);
scm_set_smob_free (block_smob_tag, bkscm_free_block_smob);
scm_set_smob_print (block_smob_tag, bkscm_print_block_smob);
block_syms_progress_smob_tag
= gdbscm_make_smob_type (block_syms_progress_smob_name,
sizeof (block_syms_progress_smob));
- scm_set_smob_mark (block_syms_progress_smob_tag,
- bkscm_mark_block_syms_progress_smob);
scm_set_smob_print (block_syms_progress_smob_tag,
bkscm_print_block_syms_progress_smob);
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index ee30597..8800923 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -130,14 +130,6 @@ frscm_inferior_frame_map (struct inferior *inferior)
return htab;
}
-/* The smob "mark" function for <gdb:frame>. */
-
-static SCM
-frscm_mark_frame_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "free" function for <gdb:frame>. */
static size_t
@@ -1058,7 +1050,6 @@ gdbscm_initialize_frames (void)
{
frame_smob_tag
= gdbscm_make_smob_type (frame_smob_name, sizeof (frame_smob));
- scm_set_smob_mark (frame_smob_tag, frscm_mark_frame_smob);
scm_set_smob_free (frame_smob_tag, frscm_free_frame_smob);
scm_set_smob_print (frame_smob_tag, frscm_print_frame_smob);
diff --git a/gdb/guile/scm-lazy-string.c b/gdb/guile/scm-lazy-string.c
index 9409379..0ba09f0 100644
--- a/gdb/guile/scm-lazy-string.c
+++ b/gdb/guile/scm-lazy-string.c
@@ -60,14 +60,6 @@ static scm_t_bits lazy_string_smob_tag;
\f
/* Administrivia for lazy string smobs. */
-/* The smob "mark" function for <gdb:lazy-string>. */
-
-static SCM
-lsscm_mark_lazy_string_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "free" function for <gdb:lazy-string>. */
static size_t
@@ -358,7 +350,6 @@ gdbscm_initialize_lazy_strings (void)
{
lazy_string_smob_tag = gdbscm_make_smob_type (lazy_string_smob_name,
sizeof (lazy_string_smob));
- scm_set_smob_mark (lazy_string_smob_tag, lsscm_mark_lazy_string_smob);
scm_set_smob_free (lazy_string_smob_tag, lsscm_free_lazy_string_smob);
scm_set_smob_print (lazy_string_smob_tag, lsscm_print_lazy_string_smob);
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index b6a92a4..cdc92ef 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -95,14 +95,6 @@ syscm_objfile_symbol_map (struct symbol *symbol)
return htab;
}
-/* The smob "mark" function for <gdb:symbol>. */
-
-static SCM
-syscm_mark_symbol_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "free" function for <gdb:symbol>. */
static size_t
@@ -756,7 +748,6 @@ gdbscm_initialize_symbols (void)
{
symbol_smob_tag
= gdbscm_make_smob_type (symbol_smob_name, sizeof (symbol_smob));
- scm_set_smob_mark (symbol_smob_tag, syscm_mark_symbol_smob);
scm_set_smob_free (symbol_smob_tag, syscm_free_symbol_smob);
scm_set_smob_print (symbol_smob_tag, syscm_print_symbol_smob);
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index 9c7f51c..2d09da3 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -119,14 +119,6 @@ stscm_objfile_symtab_map (struct symtab *symtab)
return htab;
}
-/* The smob "mark" function for <gdb:symtab>. */
-
-static SCM
-stscm_mark_symtab_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "free" function for <gdb:symtab>. */
static size_t
@@ -706,7 +698,6 @@ gdbscm_initialize_symtabs (void)
{
symtab_smob_tag
= gdbscm_make_smob_type (symtab_smob_name, sizeof (symtab_smob));
- scm_set_smob_mark (symtab_smob_tag, stscm_mark_symtab_smob);
scm_set_smob_free (symtab_smob_tag, stscm_free_symtab_smob);
scm_set_smob_print (symtab_smob_tag, stscm_print_symtab_smob);
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index b65c06a..4e09cbc 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -178,14 +178,6 @@ tyscm_type_map (struct type *type)
return htab;
}
-/* The smob "mark" function for <gdb:type>. */
-
-static SCM
-tyscm_mark_type_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "free" function for <gdb:type>. */
static size_t
@@ -1471,7 +1463,6 @@ void
gdbscm_initialize_types (void)
{
type_smob_tag = gdbscm_make_smob_type (type_smob_name, sizeof (type_smob));
- scm_set_smob_mark (type_smob_tag, tyscm_mark_type_smob);
scm_set_smob_free (type_smob_tag, tyscm_free_type_smob);
scm_set_smob_print (type_smob_tag, tyscm_print_type_smob);
scm_set_smob_equalp (type_smob_tag, tyscm_equal_p_type_smob);
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 3/9] Fix excess parentheses in Guile extension examples.
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
` (8 preceding siblings ...)
2014-04-09 16:09 ` [PATCH 6/8] Remove Guile mark functions that don't mark anything Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:09 ` [PATCH 5/9] Rename "gsmob" in Guile interface to "gdb object" Andy Wingo
` (5 subsequent siblings)
15 siblings, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/doc/guile.texi (Writing a Guile Pretty-Printer):
(Guile Types Module): Fix excess parentheses in use-modules forms.
---
gdb/doc/guile.texi | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi
index 56d817e..7d4d098 100644
--- a/gdb/doc/guile.texi
+++ b/gdb/doc/guile.texi
@@ -1600,7 +1600,7 @@ To continue the @code{my::string} example,
this code might appear in @code{(my-project my-library v1)}:
@smallexample
-(use-modules ((gdb)))
+(use-modules (gdb))
(define (register-printers objfile)
(append-objfile-pretty-printer!
(make-pretty-printer "my-string" str-lookup-function)))
@@ -1610,7 +1610,7 @@ this code might appear in @code{(my-project my-library v1)}:
And then the corresponding contents of the auto-load file would be:
@smallexample
-(use-modules ((gdb) (my-project my-library v1)))
+(use-modules (gdb) (my-project my-library v1))
(register-printers (current-objfile))
@end smallexample
@@ -1661,7 +1661,7 @@ This example doesn't need a lookup function, that is handled by the
the object that handles the lookup.
@smallexample
-(use-modules ((gdb printing)))
+(use-modules (gdb printing))
(define (build-pretty-printer)
(let ((pp (make-pretty-printer-collection "my-library")))
@@ -1673,7 +1673,7 @@ the object that handles the lookup.
And here is the autoload support:
@smallexample
-(use-modules ((gdb) (my-library)))
+(use-modules (gdb) (my-library))
(append-objfile-pretty-printer! (current-objfile) (build-pretty-printer))
@end smallexample
@@ -3264,7 +3264,7 @@ Then in gdb:
@smallexample
(gdb) start
-(gdb) guile (use-modules ((gdb) (gdb types)))
+(gdb) guile (use-modules (gdb) (gdb types))
(gdb) guile (define foo-ref (parse-and-eval "foo_ref"))
(gdb) guile (get-basic-type (value-type foo-ref))
int
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 5/9] Rename "gsmob" in Guile interface to "gdb object"
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
` (9 preceding siblings ...)
2014-04-09 16:09 ` [PATCH 3/9] Fix excess parentheses in Guile extension examples Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:09 ` [PATCH 7/8] Remove useless Guile SMOB marking functions Andy Wingo
` (4 subsequent siblings)
15 siblings, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/guile/scm-gsmob.c:
* gdb/guile/lib/gdb.scm (gdb-object-kind, gdb-object-property)
(set-gdb-object-property!, gdb-object-has-property?)
(gdb-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/guile.texi (GDB Scheme Data Types): Update the manual.
* gdb/testsuite/gdb.guile/scm-breakpoint.exp:
* gdb/testsuite/gdb.guile/scm-gsmob.exp: Adapt to renames.
---
gdb/doc/guile.texi | 37 +++++++++++++++---------------
gdb/guile/lib/gdb.scm | 12 +++++-----
gdb/guile/scm-gsmob.c | 30 ++++++++++++------------
gdb/testsuite/gdb.guile/scm-breakpoint.exp | 14 +++++------
gdb/testsuite/gdb.guile/scm-gsmob.exp | 14 +++++------
5 files changed, 53 insertions(+), 54 deletions(-)
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{<gdb:breakpoint>},
+@deffn {Scheme Procedure} gdb-object-kind object
+Return the kind of the @value{GDBN} object, e.g., @code{<gdb:breakpoint>},
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 <gdb:arch>
@@ -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 <gdb:arch>
diff --git a/gdb/guile/lib/gdb.scm b/gdb/guile/lib/gdb.scm
index 37f0934..396ccd2 100644
--- a/gdb/guile/lib/gdb.scm
+++ b/gdb/guile/lib/gdb.scm
@@ -270,13 +270,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
<gdb:value>
<gdb:block>
diff --git a/gdb/guile/scm-gsmob.c b/gdb/guile/scm-gsmob.c
index 4c88ff9..1ca6af3 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"
@@ -222,9 +222,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
@@ -246,7 +246,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
@@ -265,7 +265,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)
@@ -306,7 +306,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)
@@ -336,7 +336,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
@@ -459,23 +459,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., <gdb:breakpoint>, as a symbol." },
+Return the kind of the GDB object, e.g., <gdb:breakpoint>, 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/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) (string<? (symbol->string a) (symbol->string b)))))" \
- "= \\($prop_list\\)" "gsmob-properties"
+gdb_test "gu (print (sort (gdb-object-properties arch) (lambda (a b) (string<? (symbol->string a) (symbol->string b)))))" \
+ "= \\($prop_list\\)" "gdb-object-properties"
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 7/8] Remove useless Guile SMOB marking functions
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
` (10 preceding siblings ...)
2014-04-09 16:09 ` [PATCH 5/9] Rename "gsmob" in Guile interface to "gdb object" Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:09 ` [PATCH 1/9] Allow GDB to build against unreleased Guile 2.2 Andy Wingo
` (3 subsequent siblings)
15 siblings, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/guile/scm-breakpoint.c:
* gdb/guile/scm-exception.c:
* gdb/guile/scm-iterator.c:
* gdb/guile/scm-objfile.c:
* gdb/guile/scm-pretty-print.c:
* gdb/guile/scm-symtab.c:
* gdb/guile/scm-type.c:
* gdb/guile/scm-value.c: Remove useless SMOB mark functions -- the SMOB
data for all of these is allocated using scm_gc_malloc, so it is
automatically marked.
---
gdb/guile/scm-breakpoint.c | 14 --------------
gdb/guile/scm-exception.c | 12 ------------
gdb/guile/scm-iterator.c | 13 -------------
gdb/guile/scm-objfile.c | 14 --------------
gdb/guile/scm-pretty-print.c | 29 -----------------------------
gdb/guile/scm-symtab.c | 11 -----------
gdb/guile/scm-type.c | 11 -----------
gdb/guile/scm-value.c | 13 -------------
8 files changed, 117 deletions(-)
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index a66b82e..fbbd81b 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -70,19 +70,6 @@ static SCM internal_keyword;
\f
/* Administrivia for breakpoint smobs. */
-/* The smob "mark" function for <gdb:breakpoint>. */
-
-static SCM
-bpscm_mark_breakpoint_smob (SCM self)
-{
- breakpoint_smob *bp_smob = (breakpoint_smob *) SCM_SMOB_DATA (self);
-
- /* We don't mark containing_scm here. It is just a backlink to our
- container, and is gc'protected until the breakpoint is deleted. */
-
- return bp_smob->stop;
-}
-
/* The smob "free" function for <gdb:breakpoint>. */
static size_t
@@ -1177,7 +1164,6 @@ gdbscm_initialize_breakpoints (void)
{
breakpoint_smob_tag
= gdbscm_make_smob_type (breakpoint_smob_name, sizeof (breakpoint_smob));
- scm_set_smob_mark (breakpoint_smob_tag, bpscm_mark_breakpoint_smob);
scm_set_smob_free (breakpoint_smob_tag, bpscm_free_breakpoint_smob);
scm_set_smob_print (breakpoint_smob_tag, bpscm_print_breakpoint_smob);
diff --git a/gdb/guile/scm-exception.c b/gdb/guile/scm-exception.c
index 316f0b4..3b65b55 100644
--- a/gdb/guile/scm-exception.c
+++ b/gdb/guile/scm-exception.c
@@ -98,17 +98,6 @@ static unsigned long gdbscm_exception_count = 0;
\f
/* Administrivia for exception smobs. */
-/* The smob "mark" function for <gdb:exception>. */
-
-static SCM
-exscm_mark_exception_smob (SCM self)
-{
- exception_smob *e_smob = (exception_smob *) SCM_SMOB_DATA (self);
-
- scm_gc_mark (e_smob->key);
- return e_smob->args;
-}
-
/* The smob "print" function for <gdb:exception>. */
static int
@@ -661,7 +650,6 @@ gdbscm_initialize_exceptions (void)
{
exception_smob_tag = gdbscm_make_smob_type (exception_smob_name,
sizeof (exception_smob));
- scm_set_smob_mark (exception_smob_tag, exscm_mark_exception_smob);
scm_set_smob_print (exception_smob_tag, exscm_print_exception_smob);
gdbscm_define_functions (exception_functions, 1);
diff --git a/gdb/guile/scm-iterator.c b/gdb/guile/scm-iterator.c
index 080339b..0bbca43 100644
--- a/gdb/guile/scm-iterator.c
+++ b/gdb/guile/scm-iterator.c
@@ -107,18 +107,6 @@ itscm_set_iterator_smob_progress_x (iterator_smob *i_smob, SCM progress)
\f
/* Administrivia for iterator smobs. */
-/* The smob "mark" function for <gdb:iterator>. */
-
-static SCM
-itscm_mark_iterator_smob (SCM self)
-{
- iterator_smob *i_smob = (iterator_smob *) SCM_SMOB_DATA (self);
-
- scm_gc_mark (i_smob->object);
- scm_gc_mark (i_smob->progress);
- return i_smob->next_x;
-}
-
/* The smob "print" function for <gdb:iterator>. */
static int
@@ -358,7 +346,6 @@ gdbscm_initialize_iterators (void)
{
iterator_smob_tag = gdbscm_make_smob_type (iterator_smob_name,
sizeof (iterator_smob));
- scm_set_smob_mark (iterator_smob_tag, itscm_mark_iterator_smob);
scm_set_smob_print (iterator_smob_tag, itscm_print_iterator_smob);
gdbscm_define_functions (iterator_functions, 1);
diff --git a/gdb/guile/scm-objfile.c b/gdb/guile/scm-objfile.c
index 693d404..34ed773 100644
--- a/gdb/guile/scm-objfile.c
+++ b/gdb/guile/scm-objfile.c
@@ -59,19 +59,6 @@ ofscm_objfile_smob_pretty_printers (objfile_smob *o_smob)
\f
/* Administrivia for objfile smobs. */
-/* The smob "mark" function for <gdb:objfile>. */
-
-static SCM
-ofscm_mark_objfile_smob (SCM self)
-{
- objfile_smob *o_smob = (objfile_smob *) SCM_SMOB_DATA (self);
-
- /* We don't mark containing_scm here. It is just a backlink to our
- container, and is gc-protected until the objfile is deleted. */
-
- return o_smob->pretty_printers;
-}
-
/* The smob "print" function for <gdb:objfile>. */
static int
@@ -396,7 +383,6 @@ gdbscm_initialize_objfiles (void)
{
objfile_smob_tag
= gdbscm_make_smob_type (objfile_smob_name, sizeof (objfile_smob));
- scm_set_smob_mark (objfile_smob_tag, ofscm_mark_objfile_smob);
scm_set_smob_print (objfile_smob_tag, ofscm_print_objfile_smob);
gdbscm_define_functions (objfile_functions, 1);
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index f25eac3..dbdd749 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -121,18 +121,6 @@ static SCM ppscm_string_string;
\f
/* Administrivia for pretty-printer matcher smobs. */
-/* The smob "mark" function for <gdb:pretty-printer>. */
-
-static SCM
-ppscm_mark_pretty_printer_smob (SCM self)
-{
- pretty_printer_smob *pp_smob = (pretty_printer_smob *) SCM_SMOB_DATA (self);
-
- scm_gc_mark (pp_smob->name);
- scm_gc_mark (pp_smob->enabled);
- return pp_smob->lookup;
-}
-
/* The smob "print" function for <gdb:pretty-printer>. */
static int
@@ -248,19 +236,6 @@ gdbscm_set_pretty_printer_enabled_x (SCM self, SCM enabled)
/* Administrivia for pretty-printer-worker smobs.
These are created when a matcher recognizes a value. */
-/* The smob "mark" function for <gdb:pretty-printer-worker>. */
-
-static SCM
-ppscm_mark_pretty_printer_worker_smob (SCM self)
-{
- pretty_printer_worker_smob *w_smob
- = (pretty_printer_worker_smob *) SCM_SMOB_DATA (self);
-
- scm_gc_mark (w_smob->display_hint);
- scm_gc_mark (w_smob->to_string);
- return w_smob->children;
-}
-
/* The smob "print" function for <gdb:pretty-printer-worker>. */
static int
@@ -1096,16 +1071,12 @@ gdbscm_initialize_pretty_printers (void)
pretty_printer_smob_tag
= gdbscm_make_smob_type (pretty_printer_smob_name,
sizeof (pretty_printer_smob));
- scm_set_smob_mark (pretty_printer_smob_tag,
- ppscm_mark_pretty_printer_smob);
scm_set_smob_print (pretty_printer_smob_tag,
ppscm_print_pretty_printer_smob);
pretty_printer_worker_smob_tag
= gdbscm_make_smob_type (pretty_printer_worker_smob_name,
sizeof (pretty_printer_worker_smob));
- scm_set_smob_mark (pretty_printer_worker_smob_tag,
- ppscm_mark_pretty_printer_worker_smob);
scm_set_smob_print (pretty_printer_worker_smob_tag,
ppscm_print_pretty_printer_worker_smob);
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index 2d09da3..8910973 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -386,16 +386,6 @@ gdbscm_symtab_static_block (SCM self)
\f
/* Administrivia for sal (symtab-and-line) smobs. */
-/* The smob "mark" function for <gdb:sal>. */
-
-static SCM
-stscm_mark_sal_smob (SCM self)
-{
- sal_smob *s_smob = (sal_smob *) SCM_SMOB_DATA (self);
-
- return s_smob->symtab_scm;
-}
-
/* The smob "free" function for <gdb:sal>. */
static size_t
@@ -702,7 +692,6 @@ gdbscm_initialize_symtabs (void)
scm_set_smob_print (symtab_smob_tag, stscm_print_symtab_smob);
sal_smob_tag = gdbscm_make_smob_type (sal_smob_name, sizeof (sal_smob));
- scm_set_smob_mark (sal_smob_tag, stscm_mark_sal_smob);
scm_set_smob_free (sal_smob_tag, stscm_free_sal_smob);
scm_set_smob_print (sal_smob_tag, stscm_print_sal_smob);
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 4e09cbc..7a9cb68 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -401,16 +401,6 @@ save_objfile_types (struct objfile *objfile, void *datum)
\f
/* Administrivia for field smobs. */
-/* The smob "mark" function for <gdb:field>. */
-
-static SCM
-tyscm_mark_field_smob (SCM self)
-{
- field_smob *f_smob = (field_smob *) SCM_SMOB_DATA (self);
-
- return f_smob->type_scm;
-}
-
/* The smob "print" function for <gdb:field>. */
static int
@@ -1469,7 +1459,6 @@ gdbscm_initialize_types (void)
field_smob_tag = gdbscm_make_smob_type (field_smob_name,
sizeof (field_smob));
- scm_set_smob_mark (field_smob_tag, tyscm_mark_field_smob);
scm_set_smob_print (field_smob_tag, tyscm_print_field_smob);
gdbscm_define_integer_constants (type_integer_constants, 1);
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index 70cc7d0..f0a0b4d 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -120,18 +120,6 @@ vlscm_forget_value_smob (value_smob *v_smob)
v_smob->next->prev = v_smob->prev;
}
-/* The smob "mark" function for <gdb:value>. */
-
-static SCM
-vlscm_mark_value_smob (SCM self)
-{
- value_smob *v_smob = (value_smob *) SCM_SMOB_DATA (self);
-
- scm_gc_mark (v_smob->address);
- scm_gc_mark (v_smob->type);
- return v_smob->dynamic_type;
-}
-
/* The smob "free" function for <gdb:value>. */
static size_t
@@ -1486,7 +1474,6 @@ gdbscm_initialize_values (void)
{
value_smob_tag = gdbscm_make_smob_type (value_smob_name,
sizeof (value_smob));
- scm_set_smob_mark (value_smob_tag, vlscm_mark_value_smob);
scm_set_smob_free (value_smob_tag, vlscm_free_value_smob);
scm_set_smob_print (value_smob_tag, vlscm_print_value_smob);
scm_set_smob_equalp (value_smob_tag, vlscm_equal_p_value_smob);
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 1/9] Allow GDB to build against unreleased Guile 2.2
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
` (11 preceding siblings ...)
2014-04-09 16:09 ` [PATCH 7/8] Remove useless Guile SMOB marking functions Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:09 ` [PATCH 7/9] Remove Guile mark functions that don't mark anything Andy Wingo
` (2 subsequent siblings)
15 siblings, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/configure:
* gdb/configure.ac (try_guile_versions): Allow building with guile 2.2.
---
gdb/configure | 5 +++--
gdb/configure.ac | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/gdb/configure b/gdb/configure
index fd61bb5..307c6c9 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -3,7 +3,7 @@
# Generated by GNU Autoconf 2.64.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2014 Free Software
# Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
@@ -8750,7 +8750,8 @@ fi
-try_guile_versions="guile-2.0"
+
+try_guile_versions="guile-2.2 guile-2.0"
have_libguile=no
case "${with_guile}" in
no)
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 494d711..ff84a2e 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1154,7 +1154,7 @@ AC_MSG_RESULT([$with_guile])
dnl We check guile with pkg-config.
AC_PATH_PROG(pkg_config_prog_path, pkg-config, missing)
-try_guile_versions="guile-2.0"
+try_guile_versions="guile-2.2 guile-2.0"
have_libguile=no
case "${with_guile}" in
no)
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 7/9] Remove Guile mark functions that don't mark anything
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
` (12 preceding siblings ...)
2014-04-09 16:09 ` [PATCH 1/9] Allow GDB to build against unreleased Guile 2.2 Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:09 ` [PATCH 8/9] Remove useless Guile SMOB marking functions Andy Wingo
2014-04-09 16:09 ` [PATCH 6/9] Remove Guile GDB object property mechanism Andy Wingo
15 siblings, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/guile/scm-arch.c (arscm_mark_arch_smob):
* gdb/guile/scm-block.c (bkscm_mark_block_smob)
(bkscm_mark_block_syms_progress_smob):
* gdb/guile/scm-frame.c (frscm_mark_frame_smob):
* gdb/guile/scm-lazy-string.c (arscm_mark_arch_smob):
* gdb/guile/scm-symbol.c (lsscm_mark_lazy_string_smob):
* gdb/guile/scm-symtab.c (syscm_mark_symbol_smob):
* gdb/guile/scm-type.c (tyscm_mark_type_smob): Remove useless mark
functions.
---
gdb/guile/scm-arch.c | 9 ---------
gdb/guile/scm-block.c | 19 -------------------
gdb/guile/scm-frame.c | 9 ---------
gdb/guile/scm-lazy-string.c | 9 ---------
gdb/guile/scm-symbol.c | 9 ---------
gdb/guile/scm-symtab.c | 9 ---------
gdb/guile/scm-type.c | 9 ---------
7 files changed, 73 deletions(-)
diff --git a/gdb/guile/scm-arch.c b/gdb/guile/scm-arch.c
index 6a805c6..e4f85bf 100644
--- a/gdb/guile/scm-arch.c
+++ b/gdb/guile/scm-arch.c
@@ -45,14 +45,6 @@ static int arscm_is_arch (SCM);
\f
/* Administrivia for arch smobs. */
-/* The smob "mark" function for <gdb:arch>. */
-
-static SCM
-arscm_mark_arch_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "print" function for <gdb:arch>. */
static int
@@ -651,7 +643,6 @@ void
gdbscm_initialize_arches (void)
{
arch_smob_tag = gdbscm_make_smob_type (arch_smob_name, sizeof (arch_smob));
- scm_set_smob_mark (arch_smob_tag, arscm_mark_arch_smob);
scm_set_smob_print (arch_smob_tag, arscm_print_arch_smob);
gdbscm_define_functions (arch_functions, 1);
diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c
index 8f39e7c..a8a949f 100644
--- a/gdb/guile/scm-block.c
+++ b/gdb/guile/scm-block.c
@@ -117,14 +117,6 @@ bkscm_objfile_block_map (struct objfile *objfile)
return htab;
}
-/* The smob "mark" function for <gdb:block>. */
-
-static SCM
-bkscm_mark_block_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "free" function for <gdb:block>. */
static size_t
@@ -529,14 +521,6 @@ gdbscm_block_symbols (SCM self)
/* The <gdb:block-symbols-iterator> object,
for iterating over all symbols in a block. */
-/* The smob "mark" function for <gdb:block-symbols-iterator>. */
-
-static SCM
-bkscm_mark_block_syms_progress_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "print" function for <gdb:block-symbols-iterator>. */
static int
@@ -787,15 +771,12 @@ gdbscm_initialize_blocks (void)
{
block_smob_tag
= gdbscm_make_smob_type (block_smob_name, sizeof (block_smob));
- scm_set_smob_mark (block_smob_tag, bkscm_mark_block_smob);
scm_set_smob_free (block_smob_tag, bkscm_free_block_smob);
scm_set_smob_print (block_smob_tag, bkscm_print_block_smob);
block_syms_progress_smob_tag
= gdbscm_make_smob_type (block_syms_progress_smob_name,
sizeof (block_syms_progress_smob));
- scm_set_smob_mark (block_syms_progress_smob_tag,
- bkscm_mark_block_syms_progress_smob);
scm_set_smob_print (block_syms_progress_smob_tag,
bkscm_print_block_syms_progress_smob);
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index ee30597..8800923 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -130,14 +130,6 @@ frscm_inferior_frame_map (struct inferior *inferior)
return htab;
}
-/* The smob "mark" function for <gdb:frame>. */
-
-static SCM
-frscm_mark_frame_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "free" function for <gdb:frame>. */
static size_t
@@ -1058,7 +1050,6 @@ gdbscm_initialize_frames (void)
{
frame_smob_tag
= gdbscm_make_smob_type (frame_smob_name, sizeof (frame_smob));
- scm_set_smob_mark (frame_smob_tag, frscm_mark_frame_smob);
scm_set_smob_free (frame_smob_tag, frscm_free_frame_smob);
scm_set_smob_print (frame_smob_tag, frscm_print_frame_smob);
diff --git a/gdb/guile/scm-lazy-string.c b/gdb/guile/scm-lazy-string.c
index 9409379..0ba09f0 100644
--- a/gdb/guile/scm-lazy-string.c
+++ b/gdb/guile/scm-lazy-string.c
@@ -60,14 +60,6 @@ static scm_t_bits lazy_string_smob_tag;
\f
/* Administrivia for lazy string smobs. */
-/* The smob "mark" function for <gdb:lazy-string>. */
-
-static SCM
-lsscm_mark_lazy_string_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "free" function for <gdb:lazy-string>. */
static size_t
@@ -358,7 +350,6 @@ gdbscm_initialize_lazy_strings (void)
{
lazy_string_smob_tag = gdbscm_make_smob_type (lazy_string_smob_name,
sizeof (lazy_string_smob));
- scm_set_smob_mark (lazy_string_smob_tag, lsscm_mark_lazy_string_smob);
scm_set_smob_free (lazy_string_smob_tag, lsscm_free_lazy_string_smob);
scm_set_smob_print (lazy_string_smob_tag, lsscm_print_lazy_string_smob);
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index b6a92a4..cdc92ef 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -95,14 +95,6 @@ syscm_objfile_symbol_map (struct symbol *symbol)
return htab;
}
-/* The smob "mark" function for <gdb:symbol>. */
-
-static SCM
-syscm_mark_symbol_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "free" function for <gdb:symbol>. */
static size_t
@@ -756,7 +748,6 @@ gdbscm_initialize_symbols (void)
{
symbol_smob_tag
= gdbscm_make_smob_type (symbol_smob_name, sizeof (symbol_smob));
- scm_set_smob_mark (symbol_smob_tag, syscm_mark_symbol_smob);
scm_set_smob_free (symbol_smob_tag, syscm_free_symbol_smob);
scm_set_smob_print (symbol_smob_tag, syscm_print_symbol_smob);
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index 9c7f51c..2d09da3 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -119,14 +119,6 @@ stscm_objfile_symtab_map (struct symtab *symtab)
return htab;
}
-/* The smob "mark" function for <gdb:symtab>. */
-
-static SCM
-stscm_mark_symtab_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "free" function for <gdb:symtab>. */
static size_t
@@ -706,7 +698,6 @@ gdbscm_initialize_symtabs (void)
{
symtab_smob_tag
= gdbscm_make_smob_type (symtab_smob_name, sizeof (symtab_smob));
- scm_set_smob_mark (symtab_smob_tag, stscm_mark_symtab_smob);
scm_set_smob_free (symtab_smob_tag, stscm_free_symtab_smob);
scm_set_smob_print (symtab_smob_tag, stscm_print_symtab_smob);
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index b65c06a..4e09cbc 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -178,14 +178,6 @@ tyscm_type_map (struct type *type)
return htab;
}
-/* The smob "mark" function for <gdb:type>. */
-
-static SCM
-tyscm_mark_type_smob (SCM self)
-{
- return SCM_BOOL_F;
-}
-
/* The smob "free" function for <gdb:type>. */
static size_t
@@ -1471,7 +1463,6 @@ void
gdbscm_initialize_types (void)
{
type_smob_tag = gdbscm_make_smob_type (type_smob_name, sizeof (type_smob));
- scm_set_smob_mark (type_smob_tag, tyscm_mark_type_smob);
scm_set_smob_free (type_smob_tag, tyscm_free_type_smob);
scm_set_smob_print (type_smob_tag, tyscm_print_type_smob);
scm_set_smob_equalp (type_smob_tag, tyscm_equal_p_type_smob);
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 8/9] Remove useless Guile SMOB marking functions
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
` (13 preceding siblings ...)
2014-04-09 16:09 ` [PATCH 7/9] Remove Guile mark functions that don't mark anything Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
2014-04-09 16:09 ` [PATCH 6/9] Remove Guile GDB object property mechanism Andy Wingo
15 siblings, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/guile/scm-breakpoint.c:
* gdb/guile/scm-exception.c:
* gdb/guile/scm-iterator.c:
* gdb/guile/scm-objfile.c:
* gdb/guile/scm-pretty-print.c:
* gdb/guile/scm-symtab.c:
* gdb/guile/scm-type.c:
* gdb/guile/scm-value.c: Remove useless SMOB mark functions -- the SMOB
data for all of these is allocated using scm_gc_malloc, so it is
automatically marked.
---
gdb/guile/scm-breakpoint.c | 14 --------------
gdb/guile/scm-exception.c | 12 ------------
gdb/guile/scm-iterator.c | 13 -------------
gdb/guile/scm-objfile.c | 14 --------------
gdb/guile/scm-pretty-print.c | 29 -----------------------------
gdb/guile/scm-symtab.c | 11 -----------
gdb/guile/scm-type.c | 11 -----------
gdb/guile/scm-value.c | 13 -------------
8 files changed, 117 deletions(-)
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index a66b82e..fbbd81b 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -70,19 +70,6 @@ static SCM internal_keyword;
\f
/* Administrivia for breakpoint smobs. */
-/* The smob "mark" function for <gdb:breakpoint>. */
-
-static SCM
-bpscm_mark_breakpoint_smob (SCM self)
-{
- breakpoint_smob *bp_smob = (breakpoint_smob *) SCM_SMOB_DATA (self);
-
- /* We don't mark containing_scm here. It is just a backlink to our
- container, and is gc'protected until the breakpoint is deleted. */
-
- return bp_smob->stop;
-}
-
/* The smob "free" function for <gdb:breakpoint>. */
static size_t
@@ -1177,7 +1164,6 @@ gdbscm_initialize_breakpoints (void)
{
breakpoint_smob_tag
= gdbscm_make_smob_type (breakpoint_smob_name, sizeof (breakpoint_smob));
- scm_set_smob_mark (breakpoint_smob_tag, bpscm_mark_breakpoint_smob);
scm_set_smob_free (breakpoint_smob_tag, bpscm_free_breakpoint_smob);
scm_set_smob_print (breakpoint_smob_tag, bpscm_print_breakpoint_smob);
diff --git a/gdb/guile/scm-exception.c b/gdb/guile/scm-exception.c
index 316f0b4..3b65b55 100644
--- a/gdb/guile/scm-exception.c
+++ b/gdb/guile/scm-exception.c
@@ -98,17 +98,6 @@ static unsigned long gdbscm_exception_count = 0;
\f
/* Administrivia for exception smobs. */
-/* The smob "mark" function for <gdb:exception>. */
-
-static SCM
-exscm_mark_exception_smob (SCM self)
-{
- exception_smob *e_smob = (exception_smob *) SCM_SMOB_DATA (self);
-
- scm_gc_mark (e_smob->key);
- return e_smob->args;
-}
-
/* The smob "print" function for <gdb:exception>. */
static int
@@ -661,7 +650,6 @@ gdbscm_initialize_exceptions (void)
{
exception_smob_tag = gdbscm_make_smob_type (exception_smob_name,
sizeof (exception_smob));
- scm_set_smob_mark (exception_smob_tag, exscm_mark_exception_smob);
scm_set_smob_print (exception_smob_tag, exscm_print_exception_smob);
gdbscm_define_functions (exception_functions, 1);
diff --git a/gdb/guile/scm-iterator.c b/gdb/guile/scm-iterator.c
index 080339b..0bbca43 100644
--- a/gdb/guile/scm-iterator.c
+++ b/gdb/guile/scm-iterator.c
@@ -107,18 +107,6 @@ itscm_set_iterator_smob_progress_x (iterator_smob *i_smob, SCM progress)
\f
/* Administrivia for iterator smobs. */
-/* The smob "mark" function for <gdb:iterator>. */
-
-static SCM
-itscm_mark_iterator_smob (SCM self)
-{
- iterator_smob *i_smob = (iterator_smob *) SCM_SMOB_DATA (self);
-
- scm_gc_mark (i_smob->object);
- scm_gc_mark (i_smob->progress);
- return i_smob->next_x;
-}
-
/* The smob "print" function for <gdb:iterator>. */
static int
@@ -358,7 +346,6 @@ gdbscm_initialize_iterators (void)
{
iterator_smob_tag = gdbscm_make_smob_type (iterator_smob_name,
sizeof (iterator_smob));
- scm_set_smob_mark (iterator_smob_tag, itscm_mark_iterator_smob);
scm_set_smob_print (iterator_smob_tag, itscm_print_iterator_smob);
gdbscm_define_functions (iterator_functions, 1);
diff --git a/gdb/guile/scm-objfile.c b/gdb/guile/scm-objfile.c
index 693d404..34ed773 100644
--- a/gdb/guile/scm-objfile.c
+++ b/gdb/guile/scm-objfile.c
@@ -59,19 +59,6 @@ ofscm_objfile_smob_pretty_printers (objfile_smob *o_smob)
\f
/* Administrivia for objfile smobs. */
-/* The smob "mark" function for <gdb:objfile>. */
-
-static SCM
-ofscm_mark_objfile_smob (SCM self)
-{
- objfile_smob *o_smob = (objfile_smob *) SCM_SMOB_DATA (self);
-
- /* We don't mark containing_scm here. It is just a backlink to our
- container, and is gc-protected until the objfile is deleted. */
-
- return o_smob->pretty_printers;
-}
-
/* The smob "print" function for <gdb:objfile>. */
static int
@@ -396,7 +383,6 @@ gdbscm_initialize_objfiles (void)
{
objfile_smob_tag
= gdbscm_make_smob_type (objfile_smob_name, sizeof (objfile_smob));
- scm_set_smob_mark (objfile_smob_tag, ofscm_mark_objfile_smob);
scm_set_smob_print (objfile_smob_tag, ofscm_print_objfile_smob);
gdbscm_define_functions (objfile_functions, 1);
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index f25eac3..dbdd749 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -121,18 +121,6 @@ static SCM ppscm_string_string;
\f
/* Administrivia for pretty-printer matcher smobs. */
-/* The smob "mark" function for <gdb:pretty-printer>. */
-
-static SCM
-ppscm_mark_pretty_printer_smob (SCM self)
-{
- pretty_printer_smob *pp_smob = (pretty_printer_smob *) SCM_SMOB_DATA (self);
-
- scm_gc_mark (pp_smob->name);
- scm_gc_mark (pp_smob->enabled);
- return pp_smob->lookup;
-}
-
/* The smob "print" function for <gdb:pretty-printer>. */
static int
@@ -248,19 +236,6 @@ gdbscm_set_pretty_printer_enabled_x (SCM self, SCM enabled)
/* Administrivia for pretty-printer-worker smobs.
These are created when a matcher recognizes a value. */
-/* The smob "mark" function for <gdb:pretty-printer-worker>. */
-
-static SCM
-ppscm_mark_pretty_printer_worker_smob (SCM self)
-{
- pretty_printer_worker_smob *w_smob
- = (pretty_printer_worker_smob *) SCM_SMOB_DATA (self);
-
- scm_gc_mark (w_smob->display_hint);
- scm_gc_mark (w_smob->to_string);
- return w_smob->children;
-}
-
/* The smob "print" function for <gdb:pretty-printer-worker>. */
static int
@@ -1096,16 +1071,12 @@ gdbscm_initialize_pretty_printers (void)
pretty_printer_smob_tag
= gdbscm_make_smob_type (pretty_printer_smob_name,
sizeof (pretty_printer_smob));
- scm_set_smob_mark (pretty_printer_smob_tag,
- ppscm_mark_pretty_printer_smob);
scm_set_smob_print (pretty_printer_smob_tag,
ppscm_print_pretty_printer_smob);
pretty_printer_worker_smob_tag
= gdbscm_make_smob_type (pretty_printer_worker_smob_name,
sizeof (pretty_printer_worker_smob));
- scm_set_smob_mark (pretty_printer_worker_smob_tag,
- ppscm_mark_pretty_printer_worker_smob);
scm_set_smob_print (pretty_printer_worker_smob_tag,
ppscm_print_pretty_printer_worker_smob);
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index 2d09da3..8910973 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -386,16 +386,6 @@ gdbscm_symtab_static_block (SCM self)
\f
/* Administrivia for sal (symtab-and-line) smobs. */
-/* The smob "mark" function for <gdb:sal>. */
-
-static SCM
-stscm_mark_sal_smob (SCM self)
-{
- sal_smob *s_smob = (sal_smob *) SCM_SMOB_DATA (self);
-
- return s_smob->symtab_scm;
-}
-
/* The smob "free" function for <gdb:sal>. */
static size_t
@@ -702,7 +692,6 @@ gdbscm_initialize_symtabs (void)
scm_set_smob_print (symtab_smob_tag, stscm_print_symtab_smob);
sal_smob_tag = gdbscm_make_smob_type (sal_smob_name, sizeof (sal_smob));
- scm_set_smob_mark (sal_smob_tag, stscm_mark_sal_smob);
scm_set_smob_free (sal_smob_tag, stscm_free_sal_smob);
scm_set_smob_print (sal_smob_tag, stscm_print_sal_smob);
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 4e09cbc..7a9cb68 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -401,16 +401,6 @@ save_objfile_types (struct objfile *objfile, void *datum)
\f
/* Administrivia for field smobs. */
-/* The smob "mark" function for <gdb:field>. */
-
-static SCM
-tyscm_mark_field_smob (SCM self)
-{
- field_smob *f_smob = (field_smob *) SCM_SMOB_DATA (self);
-
- return f_smob->type_scm;
-}
-
/* The smob "print" function for <gdb:field>. */
static int
@@ -1469,7 +1459,6 @@ gdbscm_initialize_types (void)
field_smob_tag = gdbscm_make_smob_type (field_smob_name,
sizeof (field_smob));
- scm_set_smob_mark (field_smob_tag, tyscm_mark_field_smob);
scm_set_smob_print (field_smob_tag, tyscm_print_field_smob);
gdbscm_define_integer_constants (type_integer_constants, 1);
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index 70cc7d0..f0a0b4d 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -120,18 +120,6 @@ vlscm_forget_value_smob (value_smob *v_smob)
v_smob->next->prev = v_smob->prev;
}
-/* The smob "mark" function for <gdb:value>. */
-
-static SCM
-vlscm_mark_value_smob (SCM self)
-{
- value_smob *v_smob = (value_smob *) SCM_SMOB_DATA (self);
-
- scm_gc_mark (v_smob->address);
- scm_gc_mark (v_smob->type);
- return v_smob->dynamic_type;
-}
-
/* The smob "free" function for <gdb:value>. */
static size_t
@@ -1486,7 +1474,6 @@ gdbscm_initialize_values (void)
{
value_smob_tag = gdbscm_make_smob_type (value_smob_name,
sizeof (value_smob));
- scm_set_smob_mark (value_smob_tag, vlscm_mark_value_smob);
scm_set_smob_free (value_smob_tag, vlscm_free_value_smob);
scm_set_smob_print (value_smob_tag, vlscm_print_value_smob);
scm_set_smob_equalp (value_smob_tag, vlscm_equal_p_value_smob);
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 6/9] Remove Guile GDB object property mechanism
2014-04-09 16:09 [PATCH 0/8] Cleanups to Guile extension interface Andy Wingo
` (14 preceding siblings ...)
2014-04-09 16:09 ` [PATCH 8/9] Remove useless Guile SMOB marking functions Andy Wingo
@ 2014-04-09 16:09 ` Andy Wingo
15 siblings, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2014-04-09 16:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Andy Wingo
* gdb/guile/guile-internal.h: Remove scm_gsmob / GDB_SMOB_HEAD base
type; it only served as something to which object properties could be
attached: a use case already served by Guile's own object properties.
(gdbscm_init_gsmob, gdbscm_mark_gsmob, gdbscm_mark_chained_gsmob)
(gdbscm_mark_eqable_gsmob): Remove these now-unneeded functions.
* gdb/guile/scm-gsmob.c (gdbscm_init_gsmob, gdbscm_mark_gsmob)
(gdbscm_mark_chained_gsmob, gdbscm_mark_eqable_gsmob): Remove.
(gdbscm_gsmob_property, gdbscm_set_gsmob_property_x)
(gdbscm_gsmob_has_property_p, add_property_name)
(gdbscm_gsmob_properties): Remove these public interfaces, and remove
them from gsmob_functions.
* gdb/guile/scm-arch.c:
* gdb/guile/scm-block.c:
* gdb/guile/scm-breakpoint.c:
* gdb/guile/scm-exception.c:
* gdb/guile/scm-frame.c:
* gdb/guile/scm-iterator.c:
* gdb/guile/scm-lazy-string.c:
* gdb/guile/scm-objfile.c:
* gdb/guile/scm-pretty-print.c:
* gdb/guile/scm-symbol.c:
* gdb/guile/scm-symtab.c:
* gdb/guile/scm-type.c:
* gdb/guile/scm-value.c: Adapt to not include a gdb_gsmob base member,
for basic gsmobs, and to not call init/mark functions.
* gdb/doc/guile.texi (GDB Scheme Data Types): Update.
* gdb/guile/lib/gdb.scm (gdb-object-property, set-gdb-object-property)
(gdb-object-has-property?, gdb-object-properties): Remove.
* gdb/testsuite/gdb.guile/scm-breakpoint.exp:
* gdb/testsuite/gdb.guile/scm-gsmob.exp: Update to use plain old object
properties instead of gdb-object-properties.
---
gdb/doc/guile.texi | 27 ----
gdb/guile/guile-internal.h | 43 +-----
gdb/guile/lib/gdb.scm | 4 -
gdb/guile/scm-arch.c | 9 +-
gdb/guile/scm-block.c | 15 +-
gdb/guile/scm-breakpoint.c | 9 +-
gdb/guile/scm-exception.c | 8 +-
gdb/guile/scm-frame.c | 5 +-
gdb/guile/scm-gsmob.c | 216 +----------------------------
gdb/guile/scm-iterator.c | 8 +-
gdb/guile/scm-lazy-string.c | 9 +-
gdb/guile/scm-objfile.c | 9 +-
gdb/guile/scm-pretty-print.c | 16 +--
gdb/guile/scm-symbol.c | 5 +-
gdb/guile/scm-symtab.c | 14 +-
gdb/guile/scm-type.c | 13 +-
gdb/guile/scm-value.c | 8 +-
gdb/testsuite/gdb.guile/scm-breakpoint.exp | 14 +-
gdb/testsuite/gdb.guile/scm-gsmob.exp | 20 ++-
19 files changed, 47 insertions(+), 405 deletions(-)
diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi
index f7204e9..be3176b 100644
--- a/gdb/doc/guile.texi
+++ b/gdb/doc/guile.texi
@@ -342,33 +342,6 @@ Return the kind of the @value{GDBN} object, e.g., @code{<gdb:breakpoint>},
as a symbol.
@end deffn
-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-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} 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} 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} gdb-object-properties object
-Return an unsorted list of names of properties.
-@end deffn
-
@value{GDBN} defines the following object types:
@table @code
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index f95f092..bc3f55d 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -155,42 +155,23 @@ extern int gdbscm_is_procedure (SCM proc);
\f
/* GDB smobs, from scm-smob.c */
-/* All gdb smobs must contain one of the following as the first member:
- gdb_smob, chained_gdb_smob, or eqable_gdb_smob.
+/* Chained GDB smobs should have chained_gdb_smob as their first member. The
+ next,prev members of chained_gdb_smob allow for chaining gsmobs together so
+ that, for example, when an objfile is deleted we can clean up all smobs that
+ reference it.
- The next,prev members of chained_gdb_smob allow for chaining gsmobs
- together so that, for example, when an objfile is deleted we can clean up
- all smobs that reference it.
-
- The containing_scm member of eqable_gdb_smob allows for returning the
- same gsmob instead of creating a new one, allowing them to be eq?-able.
-
- IMPORTANT: chained_gdb_smob and eqable_gdb-smob are a "subclasses" of
- gdb_smob. The layout of chained_gdb_smob,eqable_gdb_smob must match
- gdb_smob as if it is a subclass. To that end we use macro GDB_SMOB_HEAD
- to ensure this. */
-
-#define GDB_SMOB_HEAD \
- /* Property list for externally added fields. */ \
- SCM properties;
-
-typedef struct
-{
- GDB_SMOB_HEAD
-} gdb_smob;
+ Eq-able GDB smobs should have eqable_gdb_smob as their first member. The
+ containing_scm member of eqable_gdb_smob allows for returning the same gsmob
+ instead of creating a new one, allowing them to be eq?-able. */
typedef struct _chained_gdb_smob
{
- GDB_SMOB_HEAD
-
struct _chained_gdb_smob *prev;
struct _chained_gdb_smob *next;
} chained_gdb_smob;
typedef struct _eqable_gdb_smob
{
- GDB_SMOB_HEAD
-
/* The object we are contained in.
This can be used for several purposes.
This is used by the eq? machinery: We need to be able to see if we have
@@ -204,8 +185,6 @@ typedef struct _eqable_gdb_smob
SCM containing_scm;
} eqable_gdb_smob;
-#undef GDB_SMOB_HEAD
-
struct objfile;
struct objfile_data;
@@ -215,19 +194,11 @@ typedef int (gsmob_pred_func) (SCM);
extern scm_t_bits gdbscm_make_smob_type (const char *name, size_t size);
-extern void gdbscm_init_gsmob (gdb_smob *base);
-
extern void gdbscm_init_chained_gsmob (chained_gdb_smob *base);
extern void gdbscm_init_eqable_gsmob (eqable_gdb_smob *base,
SCM containing_scm);
-extern SCM gdbscm_mark_gsmob (gdb_smob *base);
-
-extern SCM gdbscm_mark_chained_gsmob (chained_gdb_smob *base);
-
-extern SCM gdbscm_mark_eqable_gsmob (eqable_gdb_smob *base);
-
extern void gdbscm_add_objfile_ref (struct objfile *objfile,
const struct objfile_data *data_key,
chained_gdb_smob *g_smob);
diff --git a/gdb/guile/lib/gdb.scm b/gdb/guile/lib/gdb.scm
index 396ccd2..a3245f8 100644
--- a/gdb/guile/lib/gdb.scm
+++ b/gdb/guile/lib/gdb.scm
@@ -273,10 +273,6 @@
;; scm-gsmob.c
gdb-object-kind
- gdb-object-property
- set-gdb-object-property!
- gdb-object-has-property?
- gdb-object-properties
<gdb:value>
<gdb:block>
diff --git a/gdb/guile/scm-arch.c b/gdb/guile/scm-arch.c
index fa578f3..6a805c6 100644
--- a/gdb/guile/scm-arch.c
+++ b/gdb/guile/scm-arch.c
@@ -31,9 +31,6 @@
struct _arch_smob
{
- /* This always appears first. */
- gdb_smob base;
-
struct gdbarch *gdbarch;
};
@@ -53,10 +50,7 @@ static int arscm_is_arch (SCM);
static SCM
arscm_mark_arch_smob (SCM self)
{
- arch_smob *a_smob = (arch_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_gsmob (&a_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "print" function for <gdb:arch>. */
@@ -88,7 +82,6 @@ arscm_make_arch_smob (struct gdbarch *gdbarch)
a_smob->gdbarch = gdbarch;
a_scm = scm_new_smob (arch_smob_tag, (scm_t_bits) a_smob);
- gdbscm_init_gsmob (&a_smob->base);
return a_scm;
}
diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c
index 4e1748e..8f39e7c 100644
--- a/gdb/guile/scm-block.c
+++ b/gdb/guile/scm-block.c
@@ -56,9 +56,6 @@ typedef struct _block_smob
typedef struct
{
- /* This always appears first. */
- gdb_smob base;
-
/* The iterator for that block. */
struct block_iterator iter;
@@ -125,10 +122,7 @@ bkscm_objfile_block_map (struct objfile *objfile)
static SCM
bkscm_mark_block_smob (SCM self)
{
- block_smob *b_smob = (block_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_eqable_gsmob (&b_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "free" function for <gdb:block>. */
@@ -540,11 +534,7 @@ gdbscm_block_symbols (SCM self)
static SCM
bkscm_mark_block_syms_progress_smob (SCM self)
{
- block_syms_progress_smob *i_smob
- = (block_syms_progress_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_gsmob (&i_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "print" function for <gdb:block-symbols-iterator>. */
@@ -607,7 +597,6 @@ bkscm_make_block_syms_progress_smob (void)
memset (&i_smob->iter, 0, sizeof (i_smob->iter));
i_smob->initialized_p = 0;
smob = scm_new_smob (block_syms_progress_smob_tag, (scm_t_bits) i_smob);
- gdbscm_init_gsmob (&i_smob->base);
return smob;
}
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index d022377..a66b82e 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -38,9 +38,6 @@
typedef struct gdbscm_breakpoint_object
{
- /* This always appears first. */
- gdb_smob base;
-
/* The breakpoint number according to gdb.
This is recorded here because BP will be NULL when deleted. */
int number;
@@ -83,10 +80,7 @@ bpscm_mark_breakpoint_smob (SCM self)
/* We don't mark containing_scm here. It is just a backlink to our
container, and is gc'protected until the breakpoint is deleted. */
- scm_gc_mark (bp_smob->stop);
-
- /* Do this last. */
- return gdbscm_mark_gsmob (&bp_smob->base);
+ return bp_smob->stop;
}
/* The smob "free" function for <gdb:breakpoint>. */
@@ -192,7 +186,6 @@ bpscm_make_breakpoint_smob (void)
bp_smob->stop = SCM_BOOL_F;
bp_scm = scm_new_smob (breakpoint_smob_tag, (scm_t_bits) bp_smob);
bp_smob->containing_scm = bp_scm;
- gdbscm_init_gsmob (&bp_smob->base);
return bp_scm;
}
diff --git a/gdb/guile/scm-exception.c b/gdb/guile/scm-exception.c
index a96a350..316f0b4 100644
--- a/gdb/guile/scm-exception.c
+++ b/gdb/guile/scm-exception.c
@@ -40,9 +40,6 @@
typedef struct
{
- /* This always appears first. */
- gdb_smob base;
-
/* The key and args parameters to "throw". */
SCM key;
SCM args;
@@ -109,9 +106,7 @@ exscm_mark_exception_smob (SCM self)
exception_smob *e_smob = (exception_smob *) SCM_SMOB_DATA (self);
scm_gc_mark (e_smob->key);
- scm_gc_mark (e_smob->args);
- /* Do this last. */
- return gdbscm_mark_gsmob (&e_smob->base);
+ return e_smob->args;
}
/* The smob "print" function for <gdb:exception>. */
@@ -145,7 +140,6 @@ gdbscm_make_exception (SCM key, SCM args)
e_smob->key = key;
e_smob->args = args;
smob = scm_new_smob (exception_smob_tag, (scm_t_bits) e_smob);
- gdbscm_init_gsmob (&e_smob->base);
++gdbscm_exception_count;
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index 6031a7f..ee30597 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -135,10 +135,7 @@ frscm_inferior_frame_map (struct inferior *inferior)
static SCM
frscm_mark_frame_smob (SCM self)
{
- frame_smob *f_smob = (frame_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_eqable_gsmob (&f_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "free" function for <gdb:frame>. */
diff --git a/gdb/guile/scm-gsmob.c b/gdb/guile/scm-gsmob.c
index 1ca6af3..ef9ecb9 100644
--- a/gdb/guile/scm-gsmob.c
+++ b/gdb/guile/scm-gsmob.c
@@ -30,25 +30,16 @@
specify the gdb smob kind, that is left for another day if it ever is
needed.
- We want the objects we export to Scheme to be extensible by the user.
- A gsmob (gdb smob) adds a simple API on top of smobs to support this.
- This allows GDB objects to be easily extendable in a useful manner.
- To that end, all smobs in gdb have gdb_smob as the first member.
-
- On top of gsmobs there are "chained gsmobs". They are used to assist with
- life-time tracking of GDB objects vs Scheme objects. Gsmobs can "subclass"
+ Some GDB smobs are "chained gsmobs". They are used to assist with life-time
+ tracking of GDB objects vs Scheme objects. Gsmobs can "subclass"
chained_gdb_smob, which contains a doubly-linked list to assist with
life-time tracking.
- On top of gsmobs there are also "eqable gsmobs". Gsmobs can "subclass"
- eqable_gdb_smob instead of gdb_smob, and is used to make gsmobs eq?-able.
- This is done by recording all gsmobs in a hash table and before creating a
- gsmob first seeing if it's already in the table. Eqable gsmobs can also be
- used where lifetime-tracking is required.
-
- 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-gdb-object-property!, gdb-object-property. */
+ Some other GDB smobs are "eqable gsmobs". Gsmob implementations can
+ "subclass" eqable_gdb_smob to make gsmobs eq?-able. This is done by
+ recording all gsmobs in a hash table and before creating a gsmob first seeing
+ if it's already in the table. Eqable gsmobs can also be used where
+ lifetime-tracking is required. */
#include "defs.h"
#include "hashtab.h"
@@ -61,15 +52,6 @@
static htab_t registered_gsmobs;
-/* Gsmob properties are initialize stored as an alist to minimize space
- usage: GDB can be used to debug some really big programs, and property
- lists generally have very few elements. Once the list grows to this
- many elements then we switch to a hash table.
- The smallest Guile hashtable in 2.0 uses a vector of 31 elements.
- The value we use here is large enough to hold several expected uses,
- without being so large that we might as well just use a hashtable. */
-#define SMOB_PROP_HTAB_THRESHOLD 7
-
/* Hash function for registered_gsmobs hash table. */
static hashval_t
@@ -136,14 +118,6 @@ gdbscm_make_smob_type (const char *name, size_t size)
return result;
}
-/* Initialize a gsmob. */
-
-void
-gdbscm_init_gsmob (gdb_smob *base)
-{
- base->properties = SCM_EOL;
-}
-
/* Initialize a chained_gdb_smob.
This is the same as gdbscm_init_gsmob except that it also sets prev,next
to NULL. */
@@ -151,7 +125,6 @@ gdbscm_init_gsmob (gdb_smob *base)
void
gdbscm_init_chained_gsmob (chained_gdb_smob *base)
{
- gdbscm_init_gsmob ((gdb_smob *) base);
base->prev = NULL;
base->next = NULL;
}
@@ -163,50 +136,9 @@ gdbscm_init_chained_gsmob (chained_gdb_smob *base)
void
gdbscm_init_eqable_gsmob (eqable_gdb_smob *base, SCM containing_scm)
{
- gdbscm_init_gsmob ((gdb_smob *) base);
base->containing_scm = containing_scm;
}
-/* Call this from each smob's "mark" routine.
- In general, this should be called as:
- return gdbscm_mark_gsmob (base); */
-
-SCM
-gdbscm_mark_gsmob (gdb_smob *base)
-{
- /* Return the last one to mark as an optimization.
- The marking infrastructure will mark it for us. */
- return base->properties;
-}
-
-/* Call this from each smob's "mark" routine.
- In general, this should be called as:
- return gdbscm_mark_chained_gsmob (base); */
-
-SCM
-gdbscm_mark_chained_gsmob (chained_gdb_smob *base)
-{
- /* Return the last one to mark as an optimization.
- The marking infrastructure will mark it for us. */
- return base->properties;
-}
-
-/* Call this from each smob's "mark" routine.
- In general, this should be called as:
- return gdbscm_mark_eqable_gsmob (base); */
-
-SCM
-gdbscm_mark_eqable_gsmob (eqable_gdb_smob *base)
-{
- /* There's no need to mark containing_scm.
- Any references to it either come from Scheme in which case it will be
- marked through them, or there's a reference to the smob from gdb in
- which case the smob is GC-protected. */
-
- /* Return the last one to mark as an optimization.
- The marking infrastructure will mark it for us. */
- return base->properties;
-}
\f
/* gsmob accessors */
@@ -246,124 +178,6 @@ gdbscm_gsmob_kind (SCM self)
return result;
}
-/* (gdb-object-property gsmob property) -> object
- If property isn't present then #f is returned. */
-
-static SCM
-gdbscm_gsmob_property (SCM self, SCM property)
-{
- SCM smob;
- gdb_smob *base;
-
- smob = gsscm_get_gsmob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- base = (gdb_smob *) SCM_SMOB_DATA (self);
-
- /* Have we switched to a hash table? */
- if (gdbscm_is_true (scm_hash_table_p (base->properties)))
- return scm_hashq_ref (base->properties, property, SCM_BOOL_F);
-
- return scm_assq_ref (base->properties, property);
-}
-
-/* (set-gdb-object-property! gsmob property new-value) -> unspecified */
-
-static SCM
-gdbscm_set_gsmob_property_x (SCM self, SCM property, SCM new_value)
-{
- SCM smob, alist;
- gdb_smob *base;
-
- smob = gsscm_get_gsmob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- base = (gdb_smob *) SCM_SMOB_DATA (self);
-
- /* Have we switched to a hash table? */
- if (gdbscm_is_true (scm_hash_table_p (base->properties)))
- {
- scm_hashq_set_x (base->properties, property, new_value);
- return SCM_UNSPECIFIED;
- }
-
- alist = scm_assq_set_x (base->properties, property, new_value);
-
- /* Did we grow the list? */
- if (!scm_is_eq (alist, base->properties))
- {
- /* If we grew the list beyond a threshold in size,
- switch to a hash table. */
- if (scm_ilength (alist) >= SMOB_PROP_HTAB_THRESHOLD)
- {
- SCM elm, htab;
-
- htab = scm_c_make_hash_table (SMOB_PROP_HTAB_THRESHOLD);
- for (elm = alist; elm != SCM_EOL; elm = scm_cdr (elm))
- scm_hashq_set_x (htab, scm_caar (elm), scm_cdar (elm));
- base->properties = htab;
- return SCM_UNSPECIFIED;
- }
- }
-
- base->properties = alist;
- return SCM_UNSPECIFIED;
-}
-
-/* (gdb-object-has-property? gsmob property) -> boolean */
-
-static SCM
-gdbscm_gsmob_has_property_p (SCM self, SCM property)
-{
- SCM smob, handle;
- gdb_smob *base;
-
- smob = gsscm_get_gsmob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- base = (gdb_smob *) SCM_SMOB_DATA (self);
-
- if (gdbscm_is_true (scm_hash_table_p (base->properties)))
- handle = scm_hashq_get_handle (base->properties, property);
- else
- handle = scm_assq (property, base->properties);
-
- return scm_from_bool (gdbscm_is_true (handle));
-}
-
-/* Helper function for gdbscm_gsmob_properties. */
-
-static SCM
-add_property_name (void *closure, SCM handle)
-{
- SCM *resultp = closure;
-
- *resultp = scm_cons (scm_car (handle), *resultp);
- return SCM_UNSPECIFIED;
-}
-
-/* (gdb-object-properties gsmob) -> list
- The list is unsorted. */
-
-static SCM
-gdbscm_gsmob_properties (SCM self)
-{
- SCM smob, handle, result;
- gdb_smob *base;
-
- smob = gsscm_get_gsmob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- base = (gdb_smob *) SCM_SMOB_DATA (self);
-
- result = SCM_EOL;
- if (gdbscm_is_true (scm_hash_table_p (base->properties)))
- {
- scm_internal_hash_for_each_handle (add_property_name, &result,
- base->properties);
- }
- else
- {
- SCM elm;
-
- for (elm = base->properties; elm != SCM_EOL; elm = scm_cdr (elm))
- result = scm_cons (scm_caar (elm), result);
- }
-
- return result;
-}
\f
/* When underlying gdb data structures are deleted, we need to update any
smobs with references to them. There are several smobs that reference
@@ -463,22 +277,6 @@ static const scheme_function gsmob_functions[] =
"\
Return the kind of the GDB object, e.g., <gdb:breakpoint>, as a symbol." },
- { "gdb-object-property", 2, 0, 0, gdbscm_gsmob_property,
- "\
-Return the specified property of the GDB object." },
-
- { "set-gdb-object-property!", 3, 0, 0, gdbscm_set_gsmob_property_x,
- "\
-Set the specified property of the GDB object." },
-
- { "gdb-object-has-property?", 2, 0, 0, gdbscm_gsmob_has_property_p,
- "\
-Return #t if the specified property is present." },
-
- { "gdb-object-properties", 1, 0, 0, gdbscm_gsmob_properties,
- "\
-Return an unsorted list of names of properties." },
-
END_FUNCTIONS
};
diff --git a/gdb/guile/scm-iterator.c b/gdb/guile/scm-iterator.c
index a6deb84..080339b 100644
--- a/gdb/guile/scm-iterator.c
+++ b/gdb/guile/scm-iterator.c
@@ -60,9 +60,6 @@
struct _iterator_smob
{
- /* This always appears first. */
- gdb_smob base;
-
/* The object being iterated over. */
SCM object;
@@ -119,9 +116,7 @@ itscm_mark_iterator_smob (SCM self)
scm_gc_mark (i_smob->object);
scm_gc_mark (i_smob->progress);
- scm_gc_mark (i_smob->next_x);
- /* Do this last. */
- return gdbscm_mark_gsmob (&i_smob->base);
+ return i_smob->next_x;
}
/* The smob "print" function for <gdb:iterator>. */
@@ -160,7 +155,6 @@ itscm_make_iterator_smob (SCM object, SCM progress, SCM next)
i_smob->progress = progress;
i_smob->next_x = next;
i_scm = scm_new_smob (iterator_smob_tag, (scm_t_bits) i_smob);
- gdbscm_init_gsmob (&i_smob->base);
return i_scm;
}
diff --git a/gdb/guile/scm-lazy-string.c b/gdb/guile/scm-lazy-string.c
index e965d01..9409379 100644
--- a/gdb/guile/scm-lazy-string.c
+++ b/gdb/guile/scm-lazy-string.c
@@ -33,9 +33,6 @@
typedef struct
{
- /* This always appears first. */
- gdb_smob base;
-
/* Holds the address of the lazy string. */
CORE_ADDR address;
@@ -68,10 +65,7 @@ static scm_t_bits lazy_string_smob_tag;
static SCM
lsscm_mark_lazy_string_smob (SCM self)
{
- lazy_string_smob *ls_smob = (lazy_string_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_gsmob (&ls_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "free" function for <gdb:lazy-string>. */
@@ -132,7 +126,6 @@ lsscm_make_lazy_string_smob (CORE_ADDR address, int length,
ls_smob->type = type;
ls_scm = scm_new_smob (lazy_string_smob_tag, (scm_t_bits) ls_smob);
- gdbscm_init_gsmob (&ls_smob->base);
return ls_scm;
}
diff --git a/gdb/guile/scm-objfile.c b/gdb/guile/scm-objfile.c
index 70f7e33..693d404 100644
--- a/gdb/guile/scm-objfile.c
+++ b/gdb/guile/scm-objfile.c
@@ -30,9 +30,6 @@
struct _objfile_smob
{
- /* This always appears first. */
- gdb_smob base;
-
/* The corresponding objfile. */
struct objfile *objfile;
@@ -69,13 +66,10 @@ ofscm_mark_objfile_smob (SCM self)
{
objfile_smob *o_smob = (objfile_smob *) SCM_SMOB_DATA (self);
- scm_gc_mark (o_smob->pretty_printers);
-
/* We don't mark containing_scm here. It is just a backlink to our
container, and is gc-protected until the objfile is deleted. */
- /* Do this last. */
- return gdbscm_mark_gsmob (&o_smob->base);
+ return o_smob->pretty_printers;
}
/* The smob "print" function for <gdb:objfile>. */
@@ -113,7 +107,6 @@ ofscm_make_objfile_smob (void)
o_smob->pretty_printers = SCM_EOL;
o_scm = scm_new_smob (objfile_smob_tag, (scm_t_bits) o_smob);
o_smob->containing_scm = o_scm;
- gdbscm_init_gsmob (&o_smob->base);
return o_scm;
}
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index 1b9902f4..f25eac3 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -62,9 +62,6 @@ enum display_hint
typedef struct
{
- /* This must appear first. */
- gdb_smob base;
-
/* A string representing the name of the printer. */
SCM name;
@@ -84,9 +81,6 @@ typedef struct
typedef struct
{
- /* This must appear first. */
- gdb_smob base;
-
/* Either #f or one of the supported display hints: map, array, string.
If neither of those then the display hint is ignored (treated as #f). */
SCM display_hint;
@@ -136,9 +130,7 @@ ppscm_mark_pretty_printer_smob (SCM self)
scm_gc_mark (pp_smob->name);
scm_gc_mark (pp_smob->enabled);
- scm_gc_mark (pp_smob->lookup);
- /* Do this last. */
- return gdbscm_mark_gsmob (&pp_smob->base);
+ return pp_smob->lookup;
}
/* The smob "print" function for <gdb:pretty-printer>. */
@@ -179,7 +171,6 @@ gdbscm_make_pretty_printer (SCM name, SCM lookup)
pp_smob->lookup = lookup;
pp_smob->enabled = SCM_BOOL_T;
smob = scm_new_smob (pretty_printer_smob_tag, (scm_t_bits) pp_smob);
- gdbscm_init_gsmob (&pp_smob->base);
return smob;
}
@@ -267,9 +258,7 @@ ppscm_mark_pretty_printer_worker_smob (SCM self)
scm_gc_mark (w_smob->display_hint);
scm_gc_mark (w_smob->to_string);
- scm_gc_mark (w_smob->children);
- /* Do this last. */
- return gdbscm_mark_gsmob (&w_smob->base);
+ return w_smob->children;
}
/* The smob "print" function for <gdb:pretty-printer-worker>. */
@@ -311,7 +300,6 @@ gdbscm_make_pretty_printer_worker (SCM display_hint, SCM to_string,
w_smob->to_string = to_string;
w_smob->children = children;
w_scm = scm_new_smob (pretty_printer_worker_smob_tag, (scm_t_bits) w_smob);
- gdbscm_init_gsmob (&w_smob->base);
return w_scm;
}
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index 0c5cc05..b6a92a4 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -100,10 +100,7 @@ syscm_objfile_symbol_map (struct symbol *symbol)
static SCM
syscm_mark_symbol_smob (SCM self)
{
- symbol_smob *s_smob = (symbol_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_eqable_gsmob (&s_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "free" function for <gdb:symbol>. */
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index 7294fea..9c7f51c 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -52,9 +52,6 @@ typedef struct
typedef struct
{
- /* This always appears first. */
- gdb_smob base;
-
/* The <gdb:symtab> object of the symtab.
We store this instead of a pointer to the symtab_smob because it's not
clear GC will know the symtab_smob is referenced by us otherwise, and we
@@ -127,10 +124,7 @@ stscm_objfile_symtab_map (struct symtab *symtab)
static SCM
stscm_mark_symtab_smob (SCM self)
{
- symtab_smob *st_smob = (symtab_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_eqable_gsmob (&st_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "free" function for <gdb:symtab>. */
@@ -407,10 +401,7 @@ stscm_mark_sal_smob (SCM self)
{
sal_smob *s_smob = (sal_smob *) SCM_SMOB_DATA (self);
- scm_gc_mark (s_smob->symtab_scm);
-
- /* Do this last. */
- return gdbscm_mark_gsmob (&s_smob->base);
+ return s_smob->symtab_scm;
}
/* The smob "free" function for <gdb:sal>. */
@@ -458,7 +449,6 @@ stscm_make_sal_smob (void)
s_smob->symtab_scm = SCM_BOOL_F;
memset (&s_smob->sal, 0, sizeof (s_smob->sal));
s_scm = scm_new_smob (sal_smob_tag, (scm_t_bits) s_smob);
- gdbscm_init_gsmob (&s_smob->base);
return s_scm;
}
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 9345c28..b65c06a 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -55,9 +55,6 @@ typedef struct _type_smob
typedef struct
{
- /* This always appears first. */
- gdb_smob base;
-
/* Backlink to the containing <gdb:type> object. */
SCM type_scm;
@@ -186,10 +183,7 @@ tyscm_type_map (struct type *type)
static SCM
tyscm_mark_type_smob (SCM self)
{
- type_smob *t_smob = (type_smob *) SCM_SMOB_DATA (self);
-
- /* Do this last. */
- return gdbscm_mark_eqable_gsmob (&t_smob->base);
+ return SCM_BOOL_F;
}
/* The smob "free" function for <gdb:type>. */
@@ -422,9 +416,7 @@ tyscm_mark_field_smob (SCM self)
{
field_smob *f_smob = (field_smob *) SCM_SMOB_DATA (self);
- scm_gc_mark (f_smob->type_scm);
- /* Do this last. */
- return gdbscm_mark_gsmob (&f_smob->base);
+ return f_smob->type_scm;
}
/* The smob "print" function for <gdb:field>. */
@@ -458,7 +450,6 @@ tyscm_make_field_smob (SCM type_scm, int field_num)
f_smob->type_scm = type_scm;
f_smob->field_num = field_num;
result = scm_new_smob (field_smob_tag, (scm_t_bits) f_smob);
- gdbscm_init_gsmob (&f_smob->base);
return result;
}
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index 8ca0762..70cc7d0 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -36,9 +36,6 @@
typedef struct _value_smob
{
- /* This always appears first. */
- gdb_smob base;
-
/* Doubly linked list of values in values_in_scheme.
IWBN to use a chained_gdb_smob instead, which is doable, it just requires
a bit more casting than normal. */
@@ -132,9 +129,7 @@ vlscm_mark_value_smob (SCM self)
scm_gc_mark (v_smob->address);
scm_gc_mark (v_smob->type);
- scm_gc_mark (v_smob->dynamic_type);
- /* Do this last. */
- return gdbscm_mark_gsmob (&v_smob->base);
+ return v_smob->dynamic_type;
}
/* The smob "free" function for <gdb:value>. */
@@ -238,7 +233,6 @@ vlscm_make_value_smob (void)
v_smob->dynamic_type = SCM_UNDEFINED;
v_scm = scm_new_smob (value_smob_tag, (scm_t_bits) v_smob);
- gdbscm_init_gsmob (&v_smob->base);
return v_scm;
}
diff --git a/gdb/testsuite/gdb.guile/scm-breakpoint.exp b/gdb/testsuite/gdb.guile/scm-breakpoint.exp
index 4e78791..fd7c970 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 (gdb-object-property bkpt 'bp-data)))" "" \
- "(define (bp-eval-inf-i bkpt) (bp-data-inf-i (gdb-object-property bkpt 'bp-data)))" "" \
+ "(define (bp-eval-count bkpt) (bp-data-count (object-property bkpt 'bp-data)))" "" \
+ "(define (bp-eval-inf-i bkpt) (bp-data-inf-i (object-property bkpt 'bp-data)))" "" \
"(define (make-bp-eval location)" "" \
" (let ((bp (create-breakpoint! location)))" "" \
- " (set-gdb-object-property! bp 'bp-data (make-bp-data))" "" \
+ " (set-object-property! bp 'bp-data (make-bp-data))" "" \
" (set-breakpoint-stop! bp" "" \
" (lambda (bkpt)" "" \
- " (let ((data (gdb-object-property bkpt 'bp-data))" "" \
+ " (let ((data (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-gdb-object-property! bp 'bp-data (make-bp-data))" "" \
+ " (set-object-property! bp 'bp-data (make-bp-data))" "" \
" (set-breakpoint-stop! bp" "" \
" (lambda (bkpt)" "" \
- " (let* ((data (gdb-object-property bkpt 'bp-data))" "" \
+ " (let* ((data (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-gdb-object-property! bp 'bp-data (make-bp-data))" "" \
+ " (set-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 e33d0e1..70c3a65 100644
--- a/gdb/testsuite/gdb.guile/scm-gsmob.exp
+++ b/gdb/testsuite/gdb.guile/scm-gsmob.exp
@@ -45,26 +45,24 @@ 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 (gdb-object-has-property? arch '[prop_name $i]))" \
+ gdb_test "gu (print (object-property arch '[prop_name $i]))" \
"= #f" "property prop$i not present before set"
- gdb_test_no_output "gu (set-gdb-object-property! arch '[prop_name $i] $i)" \
- "set prop $i"
- gdb_test "gu (print (gdb-object-has-property? arch '[prop_name $i]))" \
- "= #t" "property prop$i present after set"
+ gdb_test "gu (print (set-object-property! arch '[prop_name $i] $i))" \
+ "= $i" "set prop $i"
+ gdb_test "gu (print (object-property arch '[prop_name $i]))" \
+ "= $i" "property prop$i present after set"
}
for {set i 0} {$i <= $SMOB_PROP_HTAB_THRESHOLD} {incr 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 (gdb-object-property arch '[prop_name $i]))" \
+ gdb_test "gu (print (object-property arch '[prop_name $i]))" \
"= $i" "ref prop $i"
}
-# Verify gsmob-properties.
+# Verify properties.
set prop_list ""
for {set i 0} {$i <= $SMOB_PROP_HTAB_THRESHOLD} {incr i} {
set prop_list "$prop_list [prop_name $i]"
}
set prop_list [lsort $prop_list]
verbose -log "prop_list: $prop_list"
-gdb_test "gu (print (sort (gdb-object-properties arch) (lambda (a b) (string<? (symbol->string a) (symbol->string b)))))" \
- "= \\($prop_list\\)" "gdb-object-properties"
+gdb_test "gu (print (sort (map car (object-properties arch)) (lambda (a b) (string<? (symbol->string a) (symbol->string b)))))" \
+ "= \\($prop_list\\)" "object-properties"
--
1.9.1
^ permalink raw reply [flat|nested] 21+ messages in thread