This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[1/5] RFC: fix py-block bug


The checker pointed out that we called block_for_pc in the Python code
outside of a TRY_CATCH.

Tom

	* py-block.c (gdbpy_block_for_pc): Call block_found inside
	TRY_CATCH.
---
 gdb/python/py-block.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
index 708b6a8..f0b8322 100644
--- a/gdb/python/py-block.c
+++ b/gdb/python/py-block.c
@@ -370,7 +370,7 @@ PyObject *
 gdbpy_block_for_pc (PyObject *self, PyObject *args)
 {
   gdb_py_ulongest pc;
-  struct block *block;
+  struct block *block = NULL;
   struct obj_section *section = NULL;
   struct symtab *symtab = NULL;
   volatile struct gdb_exception except;
@@ -382,6 +382,9 @@ gdbpy_block_for_pc (PyObject *self, PyObject *args)
     {
       section = find_pc_mapped_section (pc);
       symtab = find_pc_sect_symtab (pc, section);
+
+      if (symtab != NULL && symtab->objfile != NULL)
+	block = block_for_pc (pc);
     }
   GDB_PY_HANDLE_EXCEPTION (except);
 
@@ -392,7 +395,6 @@ gdbpy_block_for_pc (PyObject *self, PyObject *args)
       return NULL;
     }
 
-  block = block_for_pc (pc);
   if (block)
     return block_to_block_object (block, symtab->objfile);
 
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]