You should not set endianness when debugging (as opposed to remote).
However, you can observe the bad consequences of this:
(This is on a Linux / x86 machine, but I expect you to get similar results on Solaris / x86 and Solaris / SPARC).
int main()
{
int x = 0x1020304;
return x;
}
gdb -q a.out
Reading symbols from /tmp/a.out...done.
(gdb) b 4
Breakpoint 1 at 0x804835c: file t.c, line 4.
(gdb) r
Breakpoint 1, main () at t.c:4
4 return x;
(gdb) show endian
The target endianness is set automatically (currently little endian)
(gdb) p &x
$1 = (int *) 0xffffce60
(gdb) p/x *(int*)0xffffce60
$2 = 0x1020304
(gdb) set endian big
The target is assumed to be big endian
(gdb) p/x *(int*)0xffffce60
$3 = 0x4030201
source
share