开发者

Need info on "set endian" on solaris machine

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 sol开发者_如何学编程aris machine?

I want to know the effect of changing it.

Thanks!


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜