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

Daniel Jacobowitz
2008-12-09T02:08:28Z

On Mon, Dec 08, 2008 at 05:32:52PM -0800, Paul Pluzhnikov wrote:
> The problem is that in findvar.c:
>
> case LOC_ARG:
> if (frame == NULL)
> return 0;
> addr = get_frame_args_address (frame);
> if (!addr)
> return 0;
> addr += SYMBOL_VALUE (var);
> break;
>
> What happens if sizeof(addr) == 8 (64-bit gdb), len == 4 (32-bit target),
> get_frame_args_address() returns 0xffffbf98 (typical stack address)
> and SYMBOL_VALUE() returns -16?
>
> We end up with an impossible target address of 0x1ffffbf88.

Conclusion doesn't follow from example, but I think I'm just
confused... Do you mean that SYMBOL_VALUE is -16U or -16UL, and
that's where the wrapping comes from? But SYMBOL_VALUE is a long,
signed. Is SYMBOL_VALUE (long) 0xfffffff0? If that's the case then
the debug reader might be to blame.

--
Daniel Jacobowitz
CodeSourcery