diff options
author | Jim Blandy <jimb@codesourcery.com> | 2004-02-18 03:12:11 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2004-02-18 03:12:11 +0000 |
commit | 4589a601d6c5e3b3e9b3575e73f95f2cfe410aeb (patch) | |
tree | a351b6c078bf01755c174ff904fcf1aa9592531f | |
parent | 8cfe231d8f1bd893c4f90f48e1ca3b356c7bf727 (diff) | |
download | gdb-4589a601d6c5e3b3e9b3575e73f95f2cfe410aeb.zip gdb-4589a601d6c5e3b3e9b3575e73f95f2cfe410aeb.tar.gz gdb-4589a601d6c5e3b3e9b3575e73f95f2cfe410aeb.tar.bz2 |
* findvar.c (value_from_register): If the type has no length, just
return an acceptable value --- don't report an internal error.
-rw-r--r-- | gdb/ChangeLog | 3 | ||||
-rw-r--r-- | gdb/findvar.c | 25 |
2 files changed, 27 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 55733fb..0171e98 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,8 @@ 2004-02-17 Jim Blandy <jimb@redhat.com> + * findvar.c (value_from_register): If the type has no length, just + return an acceptable value --- don't report an internal error. + * stabsread.c (read_type): If we find any type numbers that are forward references, complain if the references aren't resolved by the time we're finished reading. diff --git a/gdb/findvar.c b/gdb/findvar.c index e737bc3..157a2db 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -618,7 +618,30 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) struct value *v = allocate_value (type); CHECK_TYPEDEF (type); - if (CONVERT_REGISTER_P (regnum, type)) + if (TYPE_LENGTH (type) == 0) + { + /* It doesn't matter much what we return for this: since the + length is zero, it could be anything. But if allowed to see + a zero-length type, the register-finding loop below will set + neither mem_stor nor reg_stor, and then report an internal + error. + + Zero-length types can legitimately arise from declarations + like 'struct {}'. GDB may also create them when it finds + bogus debugging information; for example, in GCC 2.94.4 and + binutils 2.11.93.0.2, the STABS BINCL->EXCL compression + process can create bad type numbers. GDB reads these as + TYPE_CODE_UNDEF types, with zero length. (That bug is + actually the only known way to get a zero-length value + allocated to a register --- which is what it takes to make it + here.) + + We'll just attribute the value to the original register. */ + VALUE_LVAL (v) = lval_register; + VALUE_ADDRESS (v) = regnum; + VALUE_REGNO (v) = regnum; + } + else if (CONVERT_REGISTER_P (regnum, type)) { /* The ISA/ABI need to something weird when obtaining the specified value from this register. It might need to |