Need info on “set endian” on solaris machine

五迷三道 提交于 2019-12-12 02:25:26

问题


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!


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/2848507/need-info-on-set-endian-on-solaris-machine

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!