* [python] [patch] PR python/12656 (API for special blocks)
@ 2011-10-07 17:02 Phil Muldoon
2011-10-07 20:41 ` Tom Tromey
0 siblings, 1 reply; 13+ messages in thread
From: Phil Muldoon @ 2011-10-07 17:02 UTC (permalink / raw)
To: gdb-patches
This patch addresses PR python/12656. It allows the user to determine if
a given gdb.Block is the static block, or the global block.
Additionally I added two new APIs to actually get the global/static
blocks on behalf of the user.
I also, because the global/static GDB fetch methods use const struct
*block, changed the Python code to use consts. This required some minor
refactoring both inside and outside the Python API code.
Ok?
Cheers,
Phil
--
2011-10-07 Phil Muldoon <pmuldoon@redhat.com>
PR python/12656
* python/py-frame.c (frapy_read_var): Use const struct *block.
* python/py-type.c (typy_lookup_typename): Likewise.
(typy_lookup_type): Likewise.
(typy_legacy_template_argument): Likewise.
(typy_template_argument): Likewise.
(gdbpy_lookup_type): Likewise.
* python/py-symbol.c (gdbpy_lookup_symbol): Likewise.
* python/py-block.c (blpy_block_object): Likewise.
(blpy_iter): Likewise.
(blpy_get_start): Likewise.
(blpy_get_end): Likewise.
(blpy_get_function): Likewise.
(blpy_get_superblock): Likewise.
(set_block): Likewise.
(block_to_block_object): Likewise.
(block_object_to_block): Likewise.
(blpy_is_valid): Likewise.
(blpy_get_global_block): New function.
(blpy_get_static_block): New function.
(blpy_is_global): New function.
(blpy_is_static): New function.
* blockframe.c (block_innermost_frame): Likewise.
* valops.c (value_of_variable): Likewise.
* frame.h: Update prototypes.
* python/python-internal.h: Likewise.
* value.h: Likewise.
2011-10-07 Phil Muldoon <pmuldoon@redhat.com>
PR python/12656
* gdb.texinfo (Blocks In Python): Document is_static, is_global,
global_block, static_block function.
2011-10-07 Phil Muldoon <pmuldoon@redhat.com>
PR python/12656
* gdb.python/py-block.exp: Add is_global, is_static, static_block,
global_block tests.
--
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 3b546a7..ef53a3d 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -358,7 +358,7 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address,
if there is no such frame. If BLOCK is NULL, just return NULL. */
struct frame_info *
-block_innermost_frame (struct block *block)
+block_innermost_frame (const struct block *block)
{
struct frame_info *frame;
CORE_ADDR start;
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index bb6e43c..f07c912 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -23196,6 +23196,15 @@ the time the method is called. This method is also made available to
the Python iterator object that @code{gdb.Block} provides in an iteration
context and via the Python @code{iter} built-in function.
@end defun
+@defun Block.is_global ()
+Returns @code{True} if the @code{gdb.Block} object is the global block
+for the inferior, @code{False} if not.
+@end defun
+@defun Block.is_static ()
+Returns @code{True} if the @code{gdb.Block} object is the static block
+for the inferior, @code{False} if not.
+@end defun
+
@end table
A @code{gdb.Block} object has the following attributes:
@@ -23219,6 +23228,17 @@ attribute is not writable.
The block containing this block. If this parent block does not exist,
this attribute holds @code{None}. This attribute is not writable.
@end defvar
+
+@defvar Block.global_block
+The global block associated with this block. This attribute is not
+writable.
+@end defvar
+
+@defvar Block.static_block
+The static block associated with this block. This attribute is not
+writable.
+@end defvar
+
@end table
@node Symbols In Python
diff --git a/gdb/frame.h b/gdb/frame.h
index a2052c0..0738264 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -689,7 +689,7 @@ extern void print_stack_frame (struct frame_info *, int print_level,
extern void print_frame_info (struct frame_info *, int print_level,
enum print_what print_what, int args);
-extern struct frame_info *block_innermost_frame (struct block *);
+extern struct frame_info *block_innermost_frame (const struct block *);
extern int deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc);
diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
index 08d4455..5ef7d2e 100644
--- a/gdb/python/py-block.c
+++ b/gdb/python/py-block.c
@@ -28,7 +28,7 @@
typedef struct blpy_block_object {
PyObject_HEAD
/* The GDB block structure that represents a frame's code block. */
- struct block *block;
+ const struct block *block;
/* The backing object file. There is no direct relationship in GDB
between a block and an object file. When a block is created also
store a pointer to the object file for later use. */
@@ -50,7 +50,7 @@ typedef struct {
/* Pointer back to the original source block object. Needed to
check if the block is still valid, and has not been invalidated
when an object file has been freed. */
- struct blpy_block_object *source;
+ const struct blpy_block_object *source;
} block_syms_iterator_object;
/* Require a valid block. All access to block_object->block should be
@@ -85,7 +85,7 @@ static PyObject *
blpy_iter (PyObject *self)
{
block_syms_iterator_object *block_iter_obj;
- struct block *block = NULL;
+ const struct block *block = NULL;
BLPY_REQUIRE_VALID (self, block);
@@ -105,7 +105,7 @@ blpy_iter (PyObject *self)
static PyObject *
blpy_get_start (PyObject *self, void *closure)
{
- struct block *block = NULL;
+ const struct block *block = NULL;
BLPY_REQUIRE_VALID (self, block);
@@ -115,7 +115,7 @@ blpy_get_start (PyObject *self, void *closure)
static PyObject *
blpy_get_end (PyObject *self, void *closure)
{
- struct block *block = NULL;
+ const struct block *block = NULL;
BLPY_REQUIRE_VALID (self, block);
@@ -126,7 +126,7 @@ static PyObject *
blpy_get_function (PyObject *self, void *closure)
{
struct symbol *sym;
- struct block *block = NULL;
+ const struct block *block;
BLPY_REQUIRE_VALID (self, block);
@@ -140,8 +140,8 @@ blpy_get_function (PyObject *self, void *closure)
static PyObject *
blpy_get_superblock (PyObject *self, void *closure)
{
- struct block *block = NULL;
- struct block *super_block = NULL;
+ const struct block *block;
+ const struct block *super_block;
block_object *self_obj = (block_object *) self;
BLPY_REQUIRE_VALID (self, block);
@@ -153,6 +153,47 @@ blpy_get_superblock (PyObject *self, void *closure)
Py_RETURN_NONE;
}
+/* Return the global block associated to this block. */
+
+static PyObject *
+blpy_get_global_block (PyObject *self, void *closure)
+{
+ const struct block *block;
+ const struct block *global_block;
+ block_object *self_obj = (block_object *) self;
+
+ BLPY_REQUIRE_VALID (self, block);
+
+ global_block = block_global_block (block);
+
+ return block_to_block_object (global_block,
+ self_obj->objfile);
+
+}
+
+/* Return the static block associated to this block. Return None
+ if we cannot get the static block (this is the global block). */
+
+static PyObject *
+blpy_get_static_block (PyObject *self, void *closure)
+{
+ const struct block *block;
+ const struct block *static_block;
+ block_object *self_obj = (block_object *) self;
+
+ BLPY_REQUIRE_VALID (self, block);
+
+ if (BLOCK_SUPERBLOCK (block) == NULL)
+ {
+ Py_INCREF (Py_None);
+ return Py_None;
+ }
+
+ static_block = block_static_block (block);
+
+ return block_to_block_object (static_block, self_obj->objfile);
+}
+
static void
blpy_dealloc (PyObject *obj)
{
@@ -176,7 +217,7 @@ blpy_dealloc (PyObject *obj)
with the life-cycle of the object file associated with this
block, if needed. */
static void
-set_block (block_object *obj, struct block *block,
+set_block (block_object *obj, const struct block *block,
struct objfile *objfile)
{
obj->block = block;
@@ -196,7 +237,7 @@ set_block (block_object *obj, struct block *block,
/* Create a new block object (gdb.Block) that encapsulates the struct
block object from GDB. */
PyObject *
-block_to_block_object (struct block *block, struct objfile *objfile)
+block_to_block_object (const struct block *block, struct objfile *objfile)
{
block_object *block_obj;
@@ -208,7 +249,7 @@ block_to_block_object (struct block *block, struct objfile *objfile)
}
/* Return struct block reference that is wrapped by this object. */
-struct block *
+const struct block *
block_object_to_block (PyObject *obj)
{
if (! PyObject_TypeCheck (obj, &block_object_type))
@@ -269,7 +310,7 @@ blpy_block_syms_dealloc (PyObject *obj)
static PyObject *
blpy_is_valid (PyObject *self, PyObject *args)
{
- struct block *block;
+ const struct block *block;
block = block_object_to_block (self);
if (block == NULL)
@@ -278,6 +319,39 @@ blpy_is_valid (PyObject *self, PyObject *args)
Py_RETURN_TRUE;
}
+/* Implementation of gdb.Block.is_global (self) -> Boolean.
+ Returns True if this block object is a global block. */
+
+static PyObject *
+blpy_is_global (PyObject *self, PyObject *args)
+{
+ const struct block *block;
+
+ BLPY_REQUIRE_VALID (self, block);
+
+ if (BLOCK_SUPERBLOCK (block))
+ Py_RETURN_FALSE;
+
+ Py_RETURN_TRUE;
+}
+
+/* Implementation of gdb.Block.is_static (self) -> Boolean.
+ Returns True if this block object is a static block. */
+
+static PyObject *
+blpy_is_static (PyObject *self, PyObject *args)
+{
+ const struct block *block;
+
+ BLPY_REQUIRE_VALID (self, block);
+
+ if (BLOCK_SUPERBLOCK (block) != NULL
+ && BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL)
+ Py_RETURN_TRUE;
+
+ Py_RETURN_FALSE;
+}
+
/* Implementation of gdb.BlockIterator.is_valid (self) -> Boolean.
Returns True if this block iterator object still exists in GDB */
@@ -376,6 +450,13 @@ static PyMethodDef block_object_methods[] = {
{ "is_valid", blpy_is_valid, METH_NOARGS,
"is_valid () -> Boolean.\n\
Return true if this block is valid, false if not." },
+ { "is_global", blpy_is_global, METH_NOARGS,
+ "is_global () -> Boolean.\n\
+Return true if this block is the global block, false if not." },
+ { "is_static", blpy_is_static, METH_NOARGS,
+ "is_static () -> Boolean.\n\
+Return true if this block is the static block, false if not." },
+
{NULL} /* Sentinel */
};
@@ -386,6 +467,10 @@ static PyGetSetDef block_object_getset[] = {
"Symbol that names the block, or None.", NULL },
{ "superblock", blpy_get_superblock, NULL,
"Block containing the block, or None.", NULL },
+ { "global_block", blpy_get_global_block, NULL,
+ "Block containing the global block.", NULL },
+ { "static_block", blpy_get_static_block, NULL,
+ "Block containing the static block.", NULL },
{ NULL } /* Sentinel */
};
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index 9143367..6520ad3 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -411,7 +411,7 @@ frapy_read_var (PyObject *self, PyObject *args)
else if (gdbpy_is_string (sym_obj))
{
char *var_name;
- struct block *block = NULL;
+ const struct block *block = NULL;
struct cleanup *cleanup;
volatile struct gdb_exception except;
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 8a8510e..300b94e 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -276,7 +276,7 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
static char *keywords[] = { "name", "block", "domain", NULL };
struct symbol *symbol;
PyObject *block_obj = NULL, *ret_tuple, *sym_obj, *bool_obj;
- struct block *block = NULL;
+ const struct block *block ;
if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O!i", keywords, &name,
&block_object_type, &block_obj, &domain))
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index c7fd25b..77ce8f2 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -575,7 +575,7 @@ typy_get_sizeof (PyObject *self, void *closure)
}
static struct type *
-typy_lookup_typename (const char *type_name, struct block *block)
+typy_lookup_typename (const char *type_name, const struct block *block)
{
struct type *type = NULL;
volatile struct gdb_exception except;
@@ -605,7 +605,7 @@ typy_lookup_typename (const char *type_name, struct block *block)
static struct type *
typy_lookup_type (struct demangle_component *demangled,
- struct block *block)
+ const struct block *block)
{
struct type *type;
char *type_name;
@@ -650,7 +650,7 @@ typy_lookup_type (struct demangle_component *demangled,
versions of GCC, that do not emit DW_TAG_template_*. */
static PyObject *
-typy_legacy_template_argument (struct type *type, struct block *block,
+typy_legacy_template_argument (struct type *type, const struct block *block,
int argno)
{
int i;
@@ -715,7 +715,7 @@ typy_template_argument (PyObject *self, PyObject *args)
{
int argno;
struct type *type = ((type_object *) self)->type;
- struct block *block = NULL;
+ const struct block *block = NULL;
PyObject *block_obj = NULL;
struct symbol *sym;
struct value *val = NULL;
@@ -1311,7 +1311,7 @@ gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw)
const char *type_name = NULL;
struct type *type = NULL;
PyObject *block_obj = NULL;
- struct block *block = NULL;
+ const struct block *block = NULL;
if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O", keywords,
&type_name, &block_obj))
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 71325e2..e593612 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -164,7 +164,8 @@ char *gdbpy_parse_command_name (const char *name,
PyObject *symtab_and_line_to_sal_object (struct symtab_and_line sal);
PyObject *symtab_to_symtab_object (struct symtab *symtab);
PyObject *symbol_to_symbol_object (struct symbol *sym);
-PyObject *block_to_block_object (struct block *block, struct objfile *objfile);
+PyObject *block_to_block_object (const struct block *block,
+ struct objfile *objfile);
PyObject *value_to_value_object (struct value *v);
PyObject *type_to_type_object (struct type *);
PyObject *frame_info_to_frame_object (struct frame_info *frame);
@@ -180,7 +181,7 @@ thread_object *find_thread_object (ptid_t ptid);
PyObject *find_inferior_object (int pid);
PyObject *inferior_to_inferior_object (struct inferior *inferior);
-struct block *block_object_to_block (PyObject *obj);
+const struct block *block_object_to_block (PyObject *obj);
struct symbol *symbol_object_to_symbol (PyObject *obj);
struct value *value_object_to_value (PyObject *self);
struct value *convert_value_from_python (PyObject *obj);
diff --git a/gdb/testsuite/gdb.python/py-block.exp b/gdb/testsuite/gdb.python/py-block.exp
index 98b89d9..7fc8433 100644
--- a/gdb/testsuite/gdb.python/py-block.exp
+++ b/gdb/testsuite/gdb.python/py-block.exp
@@ -48,6 +48,17 @@ gdb_test "python print block.function" "None" "First anonymous block"
gdb_test "python print block.start" "${decimal}" "Check start not None"
gdb_test "python print block.end" "${decimal}" "Check end not None"
+# Test global/static blocks
+gdb_py_test_silent_cmd "python frame = gdb.selected_frame()" "Get Frame" 0
+gdb_py_test_silent_cmd "python block = frame.block()" "Get block" 0
+gdb_test "python print block.is_global()" "False" "Not a global block"
+gdb_test "python print block.is_static()" "False" "Not a static block"
+gdb_py_test_silent_cmd "python gblock = block.global_block" "Get block" 1
+gdb_py_test_silent_cmd "python sblock = block.static_block" "Get block" 1
+gdb_test "python print gblock.is_global()" "True" "Is the global block"
+gdb_test "python print sblock.is_static()" "True" "Is the static block"
+
+
# Move up superblock(s) until we reach function block_func.
gdb_test_no_output "python block = block.superblock" "Get superblock"
gdb_test "python print block.function" "None" "Second anonymous block"
@@ -79,3 +90,4 @@ gdb_test "python print block.is_valid()" "False" \
"Check block validity"
gdb_test "python print block_iter.is_valid()" "False" \
"Check block validity"
+
diff --git a/gdb/valops.c b/gdb/valops.c
index 32d71cd..3a594c6 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1486,7 +1486,7 @@ value_repeat (struct value *arg1, int count)
}
struct value *
-value_of_variable (struct symbol *var, struct block *b)
+value_of_variable (struct symbol *var, const struct block *b)
{
struct frame_info *frame;
diff --git a/gdb/value.h b/gdb/value.h
index 5d61a0b..5541451 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -493,7 +493,7 @@ extern struct value *value_from_register (struct type *type, int regnum,
extern CORE_ADDR address_from_register (struct type *type, int regnum,
struct frame_info *frame);
-extern struct value *value_of_variable (struct symbol *var, struct block *b);
+extern struct value *value_of_variable (struct symbol *var, const struct block *b);
extern struct value *address_of_variable (struct symbol *var, struct block *b);
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [python] [patch] PR python/12656 (API for special blocks)
2011-10-07 17:02 [python] [patch] PR python/12656 (API for special blocks) Phil Muldoon
@ 2011-10-07 20:41 ` Tom Tromey
2011-10-10 9:34 ` Phil Muldoon
0 siblings, 1 reply; 13+ messages in thread
From: Tom Tromey @ 2011-10-07 20:41 UTC (permalink / raw)
To: pmuldoon; +Cc: gdb-patches
>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
Phil> This patch addresses PR python/12656. It allows the user to determine if
Phil> a given gdb.Block is the static block, or the global block.
Phil> Additionally I added two new APIs to actually get the global/static
Phil> blocks on behalf of the user.
Thanks.
Phil> I also, because the global/static GDB fetch methods use const struct
Phil> *block, changed the Python code to use consts. This required some minor
Phil> refactoring both inside and outside the Python API code.
Nice. Looks pretty good.
Phil> +@defun Block.is_global ()
Phil> +@defun Block.is_static ()
Why are these methods rather than attributes?
Phil> diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
Phil> index 08d4455..5ef7d2e 100644
Phil> --- a/gdb/python/py-block.c
Phil> +++ b/gdb/python/py-block.c
Phil> @@ -28,7 +28,7 @@
Phil> typedef struct blpy_block_object {
Phil> PyObject_HEAD
Phil> /* The GDB block structure that represents a frame's code block. */
Phil> - struct block *block;
Phil> + const struct block *block;
Phil> /* The backing object file. There is no direct relationship in GDB
Phil> between a block and an object file. When a block is created also
Phil> store a pointer to the object file for later use. */
Phil> @@ -50,7 +50,7 @@ typedef struct {
Phil> /* Pointer back to the original source block object. Needed to
Phil> check if the block is still valid, and has not been invalidated
Phil> when an object file has been freed. */
Phil> - struct blpy_block_object *source;
Phil> + const struct blpy_block_object *source;
Why make this one const?
It seems wrong given that we have to decref it when the iterator is
destroyed.
Phil> + Py_INCREF (Py_None);
Phil> + return Py_None;
I think it is more normal to use Py_RETURN_NONE here.
Phil> gdb_test "python print block_iter.is_valid()" "False" \
Phil> "Check block validity"
Phil> +
Gratuitous newline addition.
Phil> -extern struct value *value_of_variable (struct symbol *var, struct block *b);
Phil> +extern struct value *value_of_variable (struct symbol *var, const struct block *b);
This should probably wrap after the ",".
Tom
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [python] [patch] PR python/12656 (API for special blocks)
2011-10-07 20:41 ` Tom Tromey
@ 2011-10-10 9:34 ` Phil Muldoon
2011-10-10 18:27 ` Tom Tromey
0 siblings, 1 reply; 13+ messages in thread
From: Phil Muldoon @ 2011-10-10 9:34 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
Tom Tromey <tromey@redhat.com> writes:
>>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
> Phil> +@defun Block.is_global ()
> Phil> +@defun Block.is_static ()
>
> Why are these methods rather than attributes?
Because is_valid is a method in py-block.c, and I decided to continue
the is_* APIs to be methods. It confuses my *why* is_valid is a method
over an attribute, too. I guess we missed this when we ported it over
from archer (several other classes, too). I thought about changing
is_valid, but this would be an API break.
> Phil> - struct blpy_block_object *source;
> Phil> + const struct blpy_block_object *source;
>
> Why make this one const?
> It seems wrong given that we have to decref it when the iterator is
> destroyed.
Gratuitous on my part, apologies.
> Phil> + Py_INCREF (Py_None);
> Phil> + return Py_None;
>
> I think it is more normal to use Py_RETURN_NONE here.
Thanks.
> Phil> gdb_test "python print block_iter.is_valid()" "False" \
> Phil> "Check block validity"
> Phil> +
>
> Gratuitous newline addition.
>
> Phil> -extern struct value *value_of_variable (struct symbol *var, struct block *b);
> Phil> +extern struct value *value_of_variable (struct symbol *var, const struct block *b);
>
> This should probably wrap after the ",".
Thanks. I've modified the patch accordingly, but as these are trivial
changes I won't resubmit it until we reach a conclusion on the is_*
question (and we need a doc review, anyway).
Cheers,
Phil
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [python] [patch] PR python/12656 (API for special blocks)
2011-10-10 9:34 ` Phil Muldoon
@ 2011-10-10 18:27 ` Tom Tromey
2011-10-11 16:00 ` Phil Muldoon
0 siblings, 1 reply; 13+ messages in thread
From: Tom Tromey @ 2011-10-10 18:27 UTC (permalink / raw)
To: pmuldoon; +Cc: gdb-patches
>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
Phil> +@defun Block.is_global ()
Phil> +@defun Block.is_static ()
Tom> Why are these methods rather than attributes?
Phil> Because is_valid is a method in py-block.c, and I decided to continue
Phil> the is_* APIs to be methods. It confuses my *why* is_valid is a method
Phil> over an attribute, too.
Just history.
I think these should be attributes. Value.is_optimized_out is one.
Symbol has various is_* attributes.
Tom
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [python] [patch] PR python/12656 (API for special blocks)
2011-10-10 18:27 ` Tom Tromey
@ 2011-10-11 16:00 ` Phil Muldoon
[not found] ` <09787EF419216C41A903FD14EE5506DD030BEC56DF@AUSX7MCPC103.AMER.DELL.COM>
2011-10-11 17:30 ` Tom Tromey
0 siblings, 2 replies; 13+ messages in thread
From: Phil Muldoon @ 2011-10-11 16:00 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
Tom Tromey <tromey@redhat.com> writes:
>>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
>
> Phil> +@defun Block.is_global ()
> Phil> +@defun Block.is_static ()
>
> Tom> Why are these methods rather than attributes?
>
> Phil> Because is_valid is a method in py-block.c, and I decided to continue
> Phil> the is_* APIs to be methods. It confuses my *why* is_valid is a method
> Phil> over an attribute, too.
>
> Just history.
>
> I think these should be attributes. Value.is_optimized_out is one.
> Symbol has various is_* attributes.
I have regenerated the patch with requested changes, and updated the
docs.
Cheers,
Phil
--
2011-10-11 Phil Muldoon <pmuldoon@redhat.com>
PR python/12656
* python/py-frame.c (frapy_read_var): Use const struct *block.
* python/py-type.c (typy_lookup_typename): Likewise.
(typy_lookup_type): Likewise.
(typy_legacy_template_argument): Likewise.
(typy_template_argument): Likewise.
(gdbpy_lookup_type): Likewise.
* python/py-symbol.c (gdbpy_lookup_symbol): Likewise.
* python/py-block.c (blpy_block_object): Likewise.
(blpy_iter): Likewise.
(blpy_get_start): Likewise.
(blpy_get_end): Likewise.
(blpy_get_function): Likewise.
(blpy_get_superblock): Likewise.
(set_block): Likewise.
(block_to_block_object): Likewise.
(block_object_to_block): Likewise.
(blpy_is_valid): Likewise.
(blpy_get_global_block): New function.
(blpy_get_static_block): New function.
(blpy_is_global): New function.
(blpy_is_static): New function.
* blockframe.c (block_innermost_frame): Likewise.
* valops.c (value_of_variable): Likewise.
* frame.h: Update prototypes.
* python/python-internal.h: Likewise.
* value.h: Likewise.
2011-10-11 Phil Muldoon <pmuldoon@redhat.com>
PR python/12656
* gdb.texinfo (Blocks In Python): Document is_static, is_global,
global_block, static_block function.
2011-10-11 Phil Muldoon <pmuldoon@redhat.com>
PR python/12656
* gdb.python/py-block.exp: Add is_global, is_static, static_block,
global_block tests.
--
diff --git a/gdb/NEWS b/gdb/NEWS
index 1e294e0..3529a91 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -36,6 +36,11 @@
'data-directory'/python/gdb/function are now automatically loaded
on GDB start-up.
+ ** Blocks now provide four new attributes. global_block and
+ static_block will return the global and static blocks
+ respectivley. is_static and is_global are boolean attributes
+ that indicate if the block is one of those two types.
+
** Symbols now provide the "type" attribute, the type of the symbol.
** The "gdb.breakpoint" function has been deprecated in favor of
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 3b546a7..ef53a3d 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -358,7 +358,7 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address,
if there is no such frame. If BLOCK is NULL, just return NULL. */
struct frame_info *
-block_innermost_frame (struct block *block)
+block_innermost_frame (const struct block *block)
{
struct frame_info *frame;
CORE_ADDR start;
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 5a78db1..853d0a1 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -23504,6 +23504,28 @@ attribute is not writable.
The block containing this block. If this parent block does not exist,
this attribute holds @code{None}. This attribute is not writable.
@end defvar
+
+@defvar Block.global_block
+The global block associated with this block. This attribute is not
+writable.
+@end defvar
+
+@defvar Block.static_block
+The static block associated with this block. This attribute is not
+writable.
+@end defvar
+
+@defvar Block.is_global ()
+@code{True} if the @code{gdb.Block} object is the global block
+for the inferior, @code{False} if not. This attribute is not
+writable.
+@end defvar
+
+@defvar Block.is_static ()
+@code{True} if the @code{gdb.Block} object is the static block
+for the inferior, @code{False} if not. This attribute is not
+writable.
+@end defvar
@end table
@node Symbols In Python
diff --git a/gdb/frame.h b/gdb/frame.h
index f5866bd..a261a91 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -691,7 +691,7 @@ extern void print_stack_frame (struct frame_info *, int print_level,
extern void print_frame_info (struct frame_info *, int print_level,
enum print_what print_what, int args);
-extern struct frame_info *block_innermost_frame (struct block *);
+extern struct frame_info *block_innermost_frame (const struct block *);
extern int deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc);
diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
index 08d4455..3f4467a 100644
--- a/gdb/python/py-block.c
+++ b/gdb/python/py-block.c
@@ -28,7 +28,7 @@
typedef struct blpy_block_object {
PyObject_HEAD
/* The GDB block structure that represents a frame's code block. */
- struct block *block;
+ const struct block *block;
/* The backing object file. There is no direct relationship in GDB
between a block and an object file. When a block is created also
store a pointer to the object file for later use. */
@@ -85,7 +85,7 @@ static PyObject *
blpy_iter (PyObject *self)
{
block_syms_iterator_object *block_iter_obj;
- struct block *block = NULL;
+ const struct block *block = NULL;
BLPY_REQUIRE_VALID (self, block);
@@ -105,7 +105,7 @@ blpy_iter (PyObject *self)
static PyObject *
blpy_get_start (PyObject *self, void *closure)
{
- struct block *block = NULL;
+ const struct block *block = NULL;
BLPY_REQUIRE_VALID (self, block);
@@ -115,7 +115,7 @@ blpy_get_start (PyObject *self, void *closure)
static PyObject *
blpy_get_end (PyObject *self, void *closure)
{
- struct block *block = NULL;
+ const struct block *block = NULL;
BLPY_REQUIRE_VALID (self, block);
@@ -126,7 +126,7 @@ static PyObject *
blpy_get_function (PyObject *self, void *closure)
{
struct symbol *sym;
- struct block *block = NULL;
+ const struct block *block;
BLPY_REQUIRE_VALID (self, block);
@@ -140,8 +140,8 @@ blpy_get_function (PyObject *self, void *closure)
static PyObject *
blpy_get_superblock (PyObject *self, void *closure)
{
- struct block *block = NULL;
- struct block *super_block = NULL;
+ const struct block *block;
+ const struct block *super_block;
block_object *self_obj = (block_object *) self;
BLPY_REQUIRE_VALID (self, block);
@@ -153,6 +153,77 @@ blpy_get_superblock (PyObject *self, void *closure)
Py_RETURN_NONE;
}
+/* Return the global block associated to this block. */
+
+static PyObject *
+blpy_get_global_block (PyObject *self, void *closure)
+{
+ const struct block *block;
+ const struct block *global_block;
+ block_object *self_obj = (block_object *) self;
+
+ BLPY_REQUIRE_VALID (self, block);
+
+ global_block = block_global_block (block);
+
+ return block_to_block_object (global_block,
+ self_obj->objfile);
+
+}
+
+/* Return the static block associated to this block. Return None
+ if we cannot get the static block (this is the global block). */
+
+static PyObject *
+blpy_get_static_block (PyObject *self, void *closure)
+{
+ const struct block *block;
+ const struct block *static_block;
+ block_object *self_obj = (block_object *) self;
+
+ BLPY_REQUIRE_VALID (self, block);
+
+ if (BLOCK_SUPERBLOCK (block) == NULL)
+ Py_RETURN_NONE;
+
+ static_block = block_static_block (block);
+
+ return block_to_block_object (static_block, self_obj->objfile);
+}
+
+/* Implementation of gdb.Block.is_global (self) -> Boolean.
+ Returns True if this block object is a global block. */
+
+static PyObject *
+blpy_is_global (PyObject *self, void *closure)
+{
+ const struct block *block;
+
+ BLPY_REQUIRE_VALID (self, block);
+
+ if (BLOCK_SUPERBLOCK (block))
+ Py_RETURN_FALSE;
+
+ Py_RETURN_TRUE;
+}
+
+/* Implementation of gdb.Block.is_static (self) -> Boolean.
+ Returns True if this block object is a static block. */
+
+static PyObject *
+blpy_is_static (PyObject *self, void *closure)
+{
+ const struct block *block;
+
+ BLPY_REQUIRE_VALID (self, block);
+
+ if (BLOCK_SUPERBLOCK (block) != NULL
+ && BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL)
+ Py_RETURN_TRUE;
+
+ Py_RETURN_FALSE;
+}
+
static void
blpy_dealloc (PyObject *obj)
{
@@ -176,7 +247,7 @@ blpy_dealloc (PyObject *obj)
with the life-cycle of the object file associated with this
block, if needed. */
static void
-set_block (block_object *obj, struct block *block,
+set_block (block_object *obj, const struct block *block,
struct objfile *objfile)
{
obj->block = block;
@@ -196,7 +267,7 @@ set_block (block_object *obj, struct block *block,
/* Create a new block object (gdb.Block) that encapsulates the struct
block object from GDB. */
PyObject *
-block_to_block_object (struct block *block, struct objfile *objfile)
+block_to_block_object (const struct block *block, struct objfile *objfile)
{
block_object *block_obj;
@@ -208,7 +279,7 @@ block_to_block_object (struct block *block, struct objfile *objfile)
}
/* Return struct block reference that is wrapped by this object. */
-struct block *
+const struct block *
block_object_to_block (PyObject *obj)
{
if (! PyObject_TypeCheck (obj, &block_object_type))
@@ -269,7 +340,7 @@ blpy_block_syms_dealloc (PyObject *obj)
static PyObject *
blpy_is_valid (PyObject *self, PyObject *args)
{
- struct block *block;
+ const struct block *block;
block = block_object_to_block (self);
if (block == NULL)
@@ -386,6 +457,14 @@ static PyGetSetDef block_object_getset[] = {
"Symbol that names the block, or None.", NULL },
{ "superblock", blpy_get_superblock, NULL,
"Block containing the block, or None.", NULL },
+ { "global_block", blpy_get_global_block, NULL,
+ "Block containing the global block.", NULL },
+ { "static_block", blpy_get_static_block, NULL,
+ "Block containing the static block.", NULL },
+ { "is_static", blpy_is_static, NULL,
+ "Whether this block is a static block.", NULL },
+ { "is_global", blpy_is_global, NULL,
+ "Whether this block is a global block.", NULL },
{ NULL } /* Sentinel */
};
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index 75aa44e..398ce84 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -411,7 +411,7 @@ frapy_read_var (PyObject *self, PyObject *args)
else if (gdbpy_is_string (sym_obj))
{
char *var_name;
- struct block *block = NULL;
+ const struct block *block = NULL;
struct cleanup *cleanup;
volatile struct gdb_exception except;
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 8a8510e..3fdbe48 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -276,7 +276,7 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
static char *keywords[] = { "name", "block", "domain", NULL };
struct symbol *symbol;
PyObject *block_obj = NULL, *ret_tuple, *sym_obj, *bool_obj;
- struct block *block = NULL;
+ const struct block *block = NULL;
if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O!i", keywords, &name,
&block_object_type, &block_obj, &domain))
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 44a2038..a0f093e 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -576,7 +576,7 @@ typy_get_sizeof (PyObject *self, void *closure)
}
static struct type *
-typy_lookup_typename (const char *type_name, struct block *block)
+typy_lookup_typename (const char *type_name, const struct block *block)
{
struct type *type = NULL;
volatile struct gdb_exception except;
@@ -606,7 +606,7 @@ typy_lookup_typename (const char *type_name, struct block *block)
static struct type *
typy_lookup_type (struct demangle_component *demangled,
- struct block *block)
+ const struct block *block)
{
struct type *type;
char *type_name;
@@ -651,7 +651,7 @@ typy_lookup_type (struct demangle_component *demangled,
versions of GCC, that do not emit DW_TAG_template_*. */
static PyObject *
-typy_legacy_template_argument (struct type *type, struct block *block,
+typy_legacy_template_argument (struct type *type, const struct block *block,
int argno)
{
int i;
@@ -716,7 +716,7 @@ typy_template_argument (PyObject *self, PyObject *args)
{
int argno;
struct type *type = ((type_object *) self)->type;
- struct block *block = NULL;
+ const struct block *block = NULL;
PyObject *block_obj = NULL;
struct symbol *sym;
struct value *val = NULL;
@@ -1328,7 +1328,7 @@ gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw)
const char *type_name = NULL;
struct type *type = NULL;
PyObject *block_obj = NULL;
- struct block *block = NULL;
+ const struct block *block = NULL;
if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O", keywords,
&type_name, &block_obj))
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 71325e2..e593612 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -164,7 +164,8 @@ char *gdbpy_parse_command_name (const char *name,
PyObject *symtab_and_line_to_sal_object (struct symtab_and_line sal);
PyObject *symtab_to_symtab_object (struct symtab *symtab);
PyObject *symbol_to_symbol_object (struct symbol *sym);
-PyObject *block_to_block_object (struct block *block, struct objfile *objfile);
+PyObject *block_to_block_object (const struct block *block,
+ struct objfile *objfile);
PyObject *value_to_value_object (struct value *v);
PyObject *type_to_type_object (struct type *);
PyObject *frame_info_to_frame_object (struct frame_info *frame);
@@ -180,7 +181,7 @@ thread_object *find_thread_object (ptid_t ptid);
PyObject *find_inferior_object (int pid);
PyObject *inferior_to_inferior_object (struct inferior *inferior);
-struct block *block_object_to_block (PyObject *obj);
+const struct block *block_object_to_block (PyObject *obj);
struct symbol *symbol_object_to_symbol (PyObject *obj);
struct value *value_object_to_value (PyObject *self);
struct value *convert_value_from_python (PyObject *obj);
diff --git a/gdb/testsuite/gdb.python/py-block.exp b/gdb/testsuite/gdb.python/py-block.exp
index 98b89d9..6a4edf0 100644
--- a/gdb/testsuite/gdb.python/py-block.exp
+++ b/gdb/testsuite/gdb.python/py-block.exp
@@ -48,6 +48,16 @@ gdb_test "python print block.function" "None" "First anonymous block"
gdb_test "python print block.start" "${decimal}" "Check start not None"
gdb_test "python print block.end" "${decimal}" "Check end not None"
+# Test global/static blocks
+gdb_py_test_silent_cmd "python frame = gdb.selected_frame()" "Get Frame" 0
+gdb_py_test_silent_cmd "python block = frame.block()" "Get block" 0
+gdb_test "python print block.is_global" "False" "Not a global block"
+gdb_test "python print block.is_static" "False" "Not a static block"
+gdb_py_test_silent_cmd "python gblock = block.global_block" "Get block" 1
+gdb_py_test_silent_cmd "python sblock = block.static_block" "Get block" 1
+gdb_test "python print gblock.is_global" "True" "Is the global block"
+gdb_test "python print sblock.is_static" "True" "Is the static block"
+
# Move up superblock(s) until we reach function block_func.
gdb_test_no_output "python block = block.superblock" "Get superblock"
gdb_test "python print block.function" "None" "Second anonymous block"
diff --git a/gdb/valops.c b/gdb/valops.c
index e88e9dc..e15b7d4 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1491,7 +1491,7 @@ value_repeat (struct value *arg1, int count)
}
struct value *
-value_of_variable (struct symbol *var, struct block *b)
+value_of_variable (struct symbol *var, const struct block *b)
{
struct frame_info *frame;
diff --git a/gdb/value.h b/gdb/value.h
index dc2ac13..99a5b04 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -508,7 +508,8 @@ extern struct value *value_from_register (struct type *type, int regnum,
extern CORE_ADDR address_from_register (struct type *type, int regnum,
struct frame_info *frame);
-extern struct value *value_of_variable (struct symbol *var, struct block *b);
+extern struct value *value_of_variable (struct symbol *var,
+ const struct block *b);
extern struct value *address_of_variable (struct symbol *var, struct block *b);
^ permalink raw reply [flat|nested] 13+ messages in thread[parent not found: <09787EF419216C41A903FD14EE5506DD030BEC56DF@AUSX7MCPC103.AMER.DELL.COM>]
* Re: [python] [patch] PR python/12656 (API for special blocks)
[not found] ` <09787EF419216C41A903FD14EE5506DD030BEC56DF@AUSX7MCPC103.AMER.DELL.COM>
@ 2011-10-11 16:06 ` Paul Koning
2011-10-11 18:32 ` Phil Muldoon
0 siblings, 1 reply; 13+ messages in thread
From: Paul Koning @ 2011-10-11 16:06 UTC (permalink / raw)
To: gdb-patches, Phil Muldoon
> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Phil Muldoon
> Sent: Tuesday, October 11, 2011 12:00 PM
> ...
> +@defvar Block.is_global ()
> +@code{True} if the @code{gdb.Block} object is the global block for the
> +inferior, @code{False} if not. This attribute is not writable.
> +@end defvar
> +
> +@defvar Block.is_static ()
This and previous -- should not have () since these are now attributes.
paul
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [python] [patch] PR python/12656 (API for special blocks)
2011-10-11 16:06 ` Paul Koning
@ 2011-10-11 18:32 ` Phil Muldoon
0 siblings, 0 replies; 13+ messages in thread
From: Phil Muldoon @ 2011-10-11 18:32 UTC (permalink / raw)
To: Paul Koning; +Cc: gdb-patches
Paul Koning <paulkoning@comcast.net> writes:
>> -----Original Message-----
>> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Phil Muldoon
>> Sent: Tuesday, October 11, 2011 12:00 PM
>> ...
>> +@defvar Block.is_global ()
>> +@code{True} if the @code{gdb.Block} object is the global block for the
>> +inferior, @code{False} if not. This attribute is not writable.
>> +@end defvar
>> +
>> +@defvar Block.is_static ()
>
> This and previous -- should not have () since these are now attributes.
Oops gratuitous copy and paste during the method -> attribute
transition. I have fixed it in my local copy.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [python] [patch] PR python/12656 (API for special blocks)
2011-10-11 16:00 ` Phil Muldoon
[not found] ` <09787EF419216C41A903FD14EE5506DD030BEC56DF@AUSX7MCPC103.AMER.DELL.COM>
@ 2011-10-11 17:30 ` Tom Tromey
2011-10-17 10:59 ` Phil Muldoon
1 sibling, 1 reply; 13+ messages in thread
From: Tom Tromey @ 2011-10-11 17:30 UTC (permalink / raw)
To: pmuldoon; +Cc: gdb-patches
>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
Phil> + ** Blocks now provide four new attributes. global_block and
Phil> + static_block will return the global and static blocks
Phil> + respectivley. is_static and is_global are boolean attributes
Typo, "respectively".
The code bits are ok. Needs a doc review.
Tom
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [python] [patch] PR python/12656 (API for special blocks)
2011-10-11 17:30 ` Tom Tromey
@ 2011-10-17 10:59 ` Phil Muldoon
2011-10-17 11:57 ` Eli Zaretskii
0 siblings, 1 reply; 13+ messages in thread
From: Phil Muldoon @ 2011-10-17 10:59 UTC (permalink / raw)
To: Tom Tromey, eli; +Cc: gdb-patches
Tom Tromey <tromey@redhat.com> writes:
>>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
>
> Phil> + ** Blocks now provide four new attributes. global_block and
> Phil> + static_block will return the global and static blocks
> Phil> + respectivley. is_static and is_global are boolean attributes
>
> Typo, "respectively".
>
> The code bits are ok. Needs a doc review.
>
doco ping
Cheers,
Phil
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [python] [patch] PR python/12656 (API for special blocks)
2011-10-17 10:59 ` Phil Muldoon
@ 2011-10-17 11:57 ` Eli Zaretskii
2011-10-17 12:49 ` Phil Muldoon
0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2011-10-17 11:57 UTC (permalink / raw)
To: pmuldoon; +Cc: tromey, eli, gdb-patches
> From: Phil Muldoon <pmuldoon@redhat.com>
> Cc: gdb-patches@sourceware.org
> Date: Mon, 17 Oct 2011 11:31:06 +0100
>
> doco ping
Sorry, missed the original posting.
I have a couple of comments:
> +@defvar Block.is_global ()
> +@code{True} if the @code{gdb.Block} object is the global block
> +for the inferior, @code{False} if not. This attribute is not
> +writable.
If this is an attribute, why do you use "()" on the @defvar line?
Also, what do you mean by "the global block for the inferior"? why
"the" global block? There could be more than one such block, right?
And the same goes for the static attribute.
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [python] [patch] PR python/12656 (API for special blocks)
2011-10-17 11:57 ` Eli Zaretskii
@ 2011-10-17 12:49 ` Phil Muldoon
2011-10-17 15:07 ` Eli Zaretskii
0 siblings, 1 reply; 13+ messages in thread
From: Phil Muldoon @ 2011-10-17 12:49 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: tromey, eli, gdb-patches
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Phil Muldoon <pmuldoon@redhat.com>
>> Cc: gdb-patches@sourceware.org
>> Date: Mon, 17 Oct 2011 11:31:06 +0100
>>
>> doco ping
>
> Sorry, missed the original posting.
>
> I have a couple of comments:
>
>> +@defvar Block.is_global ()
>> +@code{True} if the @code{gdb.Block} object is the global block
>> +for the inferior, @code{False} if not. This attribute is not
>> +writable.
>
> If this is an attribute, why do you use "()" on the @defvar line?
They used to be methods in a previous posting, I just forgot to remove
the "()"'s when I converted them to attributes. Fixed locally.
> Also, what do you mean by "the global block for the inferior"? why
> "the" global block? There could be more than one such block, right?
Oops, fixed and for static too.
> And the same goes for the static attribute.
Is this ok, or do you want me to re-post the patch?
Cheers,
Phil
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [python] [patch] PR python/12656 (API for special blocks)
2011-10-17 12:49 ` Phil Muldoon
@ 2011-10-17 15:07 ` Eli Zaretskii
2011-10-20 12:58 ` Phil Muldoon
0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2011-10-17 15:07 UTC (permalink / raw)
To: pmuldoon; +Cc: tromey, eli, gdb-patches
> From: Phil Muldoon <pmuldoon@redhat.com>
> Cc: tromey@redhat.com, eli@gnu.org, gdb-patches@sourceware.org
> Reply-to: pmuldoon@redhat.com
> Date: Mon, 17 Oct 2011 12:57:17 +0100
>
> >> +@defvar Block.is_global ()
> >> +@code{True} if the @code{gdb.Block} object is the global block
> >> +for the inferior, @code{False} if not. This attribute is not
> >> +writable.
> >
> > If this is an attribute, why do you use "()" on the @defvar line?
>
> They used to be methods in a previous posting, I just forgot to remove
> the "()"'s when I converted them to attributes. Fixed locally.
>
> > Also, what do you mean by "the global block for the inferior"? why
> > "the" global block? There could be more than one such block, right?
>
> Oops, fixed and for static too.
>
> > And the same goes for the static attribute.
>
> Is this ok, or do you want me to re-post the patch?
Go ahead and commit, we can always fix later if needed.
Thanks.
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [python] [patch] PR python/12656 (API for special blocks)
2011-10-17 15:07 ` Eli Zaretskii
@ 2011-10-20 12:58 ` Phil Muldoon
0 siblings, 0 replies; 13+ messages in thread
From: Phil Muldoon @ 2011-10-20 12:58 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: tromey, eli, gdb-patches
Eli Zaretskii <eliz@gnu.org> writes:
>> > Also, what do you mean by "the global block for the inferior"? why
>> > "the" global block? There could be more than one such block, right?
>>
>> Oops, fixed and for static too.
>>
>> > And the same goes for the static attribute.
>>
>> Is this ok, or do you want me to re-post the patch?
>
> Go ahead and commit, we can always fix later if needed.
>
> Thanks.
So committed, thanks.
Cheers
Phil
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2011-10-20 12:33 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-07 17:02 [python] [patch] PR python/12656 (API for special blocks) Phil Muldoon
2011-10-07 20:41 ` Tom Tromey
2011-10-10 9:34 ` Phil Muldoon
2011-10-10 18:27 ` Tom Tromey
2011-10-11 16:00 ` Phil Muldoon
[not found] ` <09787EF419216C41A903FD14EE5506DD030BEC56DF@AUSX7MCPC103.AMER.DELL.COM>
2011-10-11 16:06 ` Paul Koning
2011-10-11 18:32 ` Phil Muldoon
2011-10-11 17:30 ` Tom Tromey
2011-10-17 10:59 ` Phil Muldoon
2011-10-17 11:57 ` Eli Zaretskii
2011-10-17 12:49 ` Phil Muldoon
2011-10-17 15:07 ` Eli Zaretskii
2011-10-20 12:58 ` Phil Muldoon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox