This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix a glitch in debugging 32-bit process with 64-bit GDB.
> > It seems to me that this should work without negative effect
> > (we have to be a little careful because there is a 64bit stabs
> > extension on Tru64).
>
> AFAICT, Tru64 goes through ECOFF reader in mdebugread.c, and so
> wouldn't be affected by a change to dbxread.c
You're probably right. I'm a little fuzzy now about what each module
does and I'm a little tied up to investigate further. Regardless,
I think that this won't affect Tru64 anyway.
> 2008-12-12 Paul Pluzhnikov <ppluzhnikov@google.com>
>
> * dbxread.c (read_ofile_symtab): Sign-extend 32-bit N_LSYM and
> N_PSYM STABS values for 64-bit GDB.
This looks reasonable to me, but I'd really like to have a more detailed
comment:
> + if (sizeof (nlist.n_value) > 4
> + && (type == N_LSYM || type == N_PSYM))
> + /* These are very likely to be 32-bit negative.
> + Sign-extend them for 64-bit GDB. */
> + nlist.n_value = (nlist.n_value ^ 0x80000000) - 0x80000000;
In particular:
. Why are we testing the size of nlist.n_value? (to detect that we
are using a 64bit debugger)
. You mention that this is very likely to be 32-bit negative, but
offsets on some platforms may be positive.
I'd like to see the comment detail a little the situation that we are
trying to solve (64bit gdb debugging a 32bit app). Just as a starting
point, I suggest for instance:
if (sizeof (nlist.n_value) > 4)
/* We are a 64bit debugger debugging a 32bit program.
We have to be a little careful with the n_value in the case
of N_LSYM and N_PSYM entries, because they are signed offsets
that we actually read as an unsigned 32bit value. This is
not a problem with 32bit debuggers where negative values end
up being interpreted correctly. But we need to sign-extend
the sign bit on 64bit debuggers. Otherwise, we'll end up
interpreting negative values as very large positive values... */
if (type == N_LSYM || type == N_PSYM)
nlist.n_value = (nlist.n_value ^ 0x80000000) - 0x80000000;
--
Joel