This is the mail archive of the gdb-patches@sources.redhat.com 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]

Workaround patch for PR gdb/256 (v5.1)


Hi,

Ref:
http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=256&database=gdb

I've been encountering this a lot, using gdb v5.1 against
gcc-3.x compiled C++ applications:

> (gdb) print *this
> Value can't be converted to integer.

I've tried to apply Daniel Jacobowitz's patch 

http://sources.redhat.com/ml/gdb-patches/2001-11/msg00467.html

to the head of the v5.1 branch (gdb_5_1_0_1-2002-01-03-branch),
but it appears to be for the main trunk head (need
"value_as_address" etc). Using "value_as_pointer" just
crashes gdb.

Anyway... I noticed that Daniel was fixing the functions
gnuv3_rtti_type() and gnuv3_virtual_fn_field(), so I just
made them return NULL.  This *appears* to let me at least
inspect the structure that was previously giving me the
conversion error above. 

It's a poor patch, I admit, but some may find it useful,
as we do. I'd like to produce a test case too, but have
been unsuccessful so far.

Regards,
David Dawkins

--
Index: gnu-v3-abi.c
===================================================================
RCS file: /cvs/src/src/gdb/gnu-v3-abi.c,v
retrieving revision 1.3
diff -p -u -r1.3 gnu-v3-abi.c
--- gnu-v3-abi.c	2001/06/07 14:51:20	1.3
+++ gnu-v3-abi.c	2002/01/04 18:09:18
@@ -196,6 +196,8 @@ gnuv3_rtti_type (struct value *value,
   struct type *run_time_type;
   LONGEST offset_to_top;
 
+  return NULL; /* Workaround for PR gdb/256 - David Dawkins */
+
   /* We only have RTTI for class objects.  */
   if (TYPE_CODE (value_type) != TYPE_CODE_CLASS)
     return NULL;
@@ -279,6 +281,8 @@ gnuv3_virtual_fn_field (struct value **v
   CORE_ADDR vtable_address;
   struct value *vtable;
   struct value *vfn;
+
+  return NULL; /* Workaround for PR gdb/256 - David Dawkins */
 
   /* Some simple sanity checks.  */
   if (TYPE_CODE (value_type) != TYPE_CODE_CLASS)


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