需要关于“set endian”的信息在solaris机器上 [英] Need info on "set endian" on solaris machine

查看:224
本文介绍了需要关于“set endian”的信息在solaris机器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何1请告诉或显示任何程序在我在solaris机器上的gdb中设置endian little之前和之后的行为差异吗?

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!

推荐答案

你应该永远不要在自己的本地(而不是远程)调试时设置字节序。

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:

(这是在Linux / x86机器上,但我希望在Solaris / x86和Solaris / SPARC上可以得到类似的结果)。
$ b

(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

这篇关于需要关于“set endian”的信息在solaris机器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆