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]

Re: [patch] Fix a glitch in debugging 32-bit process with 64-bit GDB.


On Mon, Dec 15, 2008 at 12:58 AM, Joel Brobecker <brobecker@adacore.com> wrote:

> 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;

Thanks, I slightly re-worded this.

OK to commit?


-- 
Paul Pluzhnikov

2008-12-15  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.

Attachment: gdb-1526195-20081215.txt
Description: Text document


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