Gdb "ignores" breakpoints when linking text to 0xC0000000

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
hrniels
Member
Member
Posts: 53
Joined: Wed Nov 05, 2008 5:18 am
Location: Marburg, Germany

Re: Gdb "ignores" breakpoints when linking text to 0xC0000000

Post by hrniels »

hm..no, that's not the problem. QEMU doesn't crash here. Perhaps Walling has put "higherhalf" to .setup instead of .text?
However, the problem is "just" that breakpoints do not work within the higherhalf -> main -> ... call-hierarchie. So as if gdb doesn't like the gdt-change within the loader-function. As I've mentioned above, breakpoints work for example within the interrupt-handling.

hrniels

Edit: Oh, I have just figured out that the breakpoints just don't work within the temporary GDT with a base of 0x40000000. As soon as the GDT is reset to a flat address-space (and paging is enabled), everything works fine. Sorry that I didn't get that earlier :oops: That makes sense, somehow, of course.
So I don't know if there actually is a solution for it (maybe other people using this strategy simply live with it because it isn't much code where breakpoints don't work). But of course it would be nice if there is any :)
In any case, thank you very much for your help! :)
Last edited by hrniels on Thu Nov 06, 2008 1:27 pm, edited 1 time in total.
User avatar
Walling
Member
Member
Posts: 158
Joined: Mon Dec 04, 2006 6:06 am
Location: Berlin, Germany

Re: Gdb "ignores" breakpoints when linking text to 0xC0000000

Post by Walling »

hrniels wrote:hm..no, that's not the problem. QEMU doesn't crash here. Perhaps Walling has put "higherhalf" to .setup instead of .text?
Yeah, that was my fault.
hrniels wrote:However, the problem is "just" that breakpoints do not work within the higherhalf -> main -> ... call-hierarchie. So as if gdb doesn't like the gdt-change within the loader-function. As I've mentioned above, breakpoints work for example within the interrupt-handling.
If you put loader in the .setup section you can set a breakpoint on that location. From that point you can single-step through your kernel. GDB will recognize where you set breakpoints (prints "Breakpoint reached...") on other symbols like higherhalf and main. Not that it is a solution to your problem, because you have to single-step. Maybe GDB will play with you again after paging is setup? If that is the case you just have to use the single-step debug solution until your paging works.
hrniels
Member
Member
Posts: 53
Joined: Wed Nov 05, 2008 5:18 am
Location: Marburg, Germany

Re: Gdb "ignores" breakpoints when linking text to 0xC0000000

Post by hrniels »

Walling wrote:If you put loader in the .setup section you can set a breakpoint on that location. From that point you can single-step through your kernel. GDB will recognize where you set breakpoints (prints "Breakpoint reached...") on other symbols like higherhalf and main. Not that it is a solution to your problem, because you have to single-step. Maybe GDB will play with you again after paging is setup? If that is the case you just have to use the single-step debug solution until your paging works.
Yes, that's true (see edit in my post above). I think I can live with it. Thanks :)

hrniels
Post Reply