Re: register type as signed or unsigned?

Mark Kettenis
2006-10-11T07:00:00Z

> On Wed, 11 Oct 2006 02:37:57 +0200, ligang@sunnorth.com.cn wrote:
> > Daniel Jacobowitz <drow@false.org> wrote on 2006-10-10 20:50:02:
> ...
> > > No; in fact, it doesn't make much difference. You should use
> > whichever
> > > is "more natural" for your target instruction set; it will affect
> > > "print $reg" and "info reg".
> >
> > That is to say, whether builtin_type_int32 or builtin_type_uint32 is
> > correct for GDB.
>
> If the register is used as address, use "uint32".

If the register is typically used as an address, builtin_type_void_data_ptr
is probably more appropriate. For the instruction pointer you should use
builtin_type_void_func_ptr though.

> If it is used for general computation incl. offsets in memory, use
> "int32".
> "uint32" should be IMO a safer bet but sometimes you may need
> `(int)$regname'.

int32 is IMHO more useful since actually large unsigned numbers are rare.
But if your CPU only supports unsigned integer math, uint32 is the right
choice.

Mark