Can I print the gdtr and gdt descriptor under gdb?

心不动则不痛 提交于 2019-12-30 23:28:23

问题


I want to use gdb to see my GDTR/LDTR/TTR and segment register

invisiable part(x86) so in gdb I enter "p/x $gdtr"....etc but the result is "$6 = Value can't be converted to integer" and in gdb I enter "p/x $cs" the only result is the CS, just visiable part

can anyone tell me how to view these value??

thanks for your answer


回答1:


If GDB had such a function then this function would only work if GDB was able to read the GDTR using the SGDT instruction. This would mean that GDB had to run in ring 0.

Neither Linux nor Windows nor Mac OS allows running applications (like GDB) in ring 0 so it will not work for local applications.

If you use remote debugging (you debug another computer or a virtual machine using an RS-232 or TCP/IP connection): The default protocol used for remote debugging does not specify packets for reading the GDTR.

In the case of remote debugging the backend (piece of code on the debugged computer) may define non-standard features using the "monitor" command. You would be able to implement such a feature using a command like "monitor readspr gdtr".



来源:https://stackoverflow.com/questions/28263624/can-i-print-the-gdtr-and-gdt-descriptor-under-gdb

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