OSDev.org
https://forum.osdev.org/

Debugging an i386 userspace on an amd64 target
https://forum.osdev.org/viewtopic.php?f=1&t=33825
Page 1 of 1

Author:  ameame [ Mon Aug 12, 2019 8:13 pm ]
Post subject:  Debugging an i386 userspace on an amd64 target

I recently ported my x86 kernel to support x64 and I'm having a problem debugging applications in gdb+qemu. Before I would load the kernel into gdb, pause execution then load the userland application and execute it. Now because of architecture mixing gdb can't change the debug architecture to 32-bit and it can't backtrace or display local variables correctly.

Is there at least a better way to debug applications than this?

Author:  MichaelPetch [ Mon Aug 12, 2019 9:25 pm ]
Post subject:  Re: Debugging an i386 userspace on an amd64 target

Are you the fellow who asked the core dump question on Stackoverflow recently?

Author:  MichaelPetch [ Mon Aug 12, 2019 9:27 pm ]
Post subject:  Re: Debugging an i386 userspace on an amd64 target

If you ported your OS to 64-bit then why would it be running 32-bit code? Do you switch tom 32-bit compatibility mode to execute 32-bit userland (ring 3) code?

Author:  ameame [ Mon Aug 12, 2019 9:29 pm ]
Post subject:  Re: Debugging an i386 userspace on an amd64 target

MichaelPetch wrote:
Are you the fellow who asked the core dump question on Stackoverflow recently?

Nah, never posted to stackoverflow before.

MichaelPetch wrote:
If you ported your OS to 64-bit then why would it be running 32-bit code? Do you switch tom 32-bit compatibility mode to execute 32-bit userland code?

Oops, that was a mistake. I mean't ported my kernel to 64-bit. My processes run in compatibility mode.

Author:  MichaelPetch [ Mon Aug 12, 2019 9:59 pm ]
Post subject:  Re: Debugging an i386 userspace on an amd64 target

Sounds like you are running into this issue that started becoming a problem as of 2.9 of QEMU: https://bugs.launchpad.net/qemu/+bug/1686170 . Any chance you could build 2.8.1 of QEMU and try?

Author:  ameame [ Mon Aug 12, 2019 10:51 pm ]
Post subject:  Re: Debugging an i386 userspace on an amd64 target

MichaelPetch wrote:
Sounds like you are running into this issue that started becoming an issue as of 2.9 of QEMU: https://bugs.launchpad.net/qemu/+bug/1686170 . Any chance you could build 2.8.1 of QEMU and try?

Thanks, it worked! I did have to do the disconnect trick and patch in some files so it's compatible with my glibc though.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/