OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 3:04 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Debugging an i386 userspace on an amd64 target
PostPosted: Mon Aug 12, 2019 8:13 pm 
Offline

Joined: Mon Aug 12, 2019 7:48 pm
Posts: 3
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?


Last edited by ameame on Mon Aug 12, 2019 9:31 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Debugging an i386 userspace on an amd64 target
PostPosted: Mon Aug 12, 2019 9:25 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
Are you the fellow who asked the core dump question on Stackoverflow recently?


Top
 Profile  
 
 Post subject: Re: Debugging an i386 userspace on an amd64 target
PostPosted: Mon Aug 12, 2019 9:27 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
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?


Top
 Profile  
 
 Post subject: Re: Debugging an i386 userspace on an amd64 target
PostPosted: Mon Aug 12, 2019 9:29 pm 
Offline

Joined: Mon Aug 12, 2019 7:48 pm
Posts: 3
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.


Top
 Profile  
 
 Post subject: Re: Debugging an i386 userspace on an amd64 target
PostPosted: Mon Aug 12, 2019 9:59 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
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?


Last edited by MichaelPetch on Tue Aug 13, 2019 10:06 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Debugging an i386 userspace on an amd64 target
PostPosted: Mon Aug 12, 2019 10:51 pm 
Offline

Joined: Mon Aug 12, 2019 7:48 pm
Posts: 3
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Majestic-12 [Bot], mrjbom and 69 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group