tags:

views:

34

answers:

2

Hi,

Can any 1 please tell or show the difference in the behaviour of any program before and after I "set endian little" in gdb on solaris machine?

I want to know the effect of changing it.

Thanks!

+2  A: 

You should never have to set endianness when doing native (as opposed to remote) debugging.

You can however observe the ill effects of doing that:

(This is on Linux/x86 machine, but I expect you'll 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
Employed Russian
+1  A: 

To fully answer your question, this setting will have absolutely no effect whatsoever on the debugged program, only on gdb output as Employed Russian already stated.

jlliagre