English 中文(简体)
Debugging with Bochs + GDB: "cannot find bounds of current function"?
原标题:

I m working on writing an OS and I m running into problems trying to debug my code. I m using GDB to connect to Bochs GDB stub to "remotely" debug my kernel. Connecting works fine, as does loading debugging symbols from the kernel file. I set a breakpoint for the kmain function, which is successfully located, and the debugger breaks correctly (inside my kernel). However, I can t "step" or "next" through my code, nor can GDB apparently determine which line of code is the current line.

When I try to "step", I get the following message: "Cannot find bounds of current function". This is the only error message I get at any point.

My code is being compiled in GCC with the -g flag (I ve tried other types of debugging information using GCC options; none have worked.) I have tried looking through the GDB manual , as well as searching for the answer, and I m totally stumped. Any help would be amazing.

Thanks!

最佳回答

Well, I got debugging working, but I had to switch emulators. I was able to get GDB working with Qemu, even though I also had problems doing that. To get GDB to connect to the Qemu gdbserver, I had to pass the following option to Qemu: "-gdb tcp::1234,ipv4". Took me forever to figure that out... Debugging works perfectly now!

问题回答

Googling throws up "This is because when you attached to gdbserver, the process under debug has not completed the C start-up code" http://www.cygwin.com/ml/gdb/2005-03/msg00237.html... http://www.bravegnu.org/gnu-eprog/c-startup.html describes the process for when you are coding for embedded devices, maybe this will help?

If you find the answer please post here as I d like to know what the solution to the problem is too.

I don t know why but bochs with gdb-stub enabled seems to be picky with the config options. On some system following options will break it: --enable-x86-64, --enable-vmx





相关问题
tell gdb to disassemble "unknown" code

is it possible to configure gdb in order to debug assembly code when there are no debug symbols or no sources available ? I mean showing assembly instruction by assembly instruction when performing a ...

C++ Netbeans debugging issues

I installed netbeans6.7.1 ide for c/c++ also i have mingw/msys cygwin installed and i have given C:Msysin as environment variable path.It has gdb7 version.However wheni run dbugging thru netbeans ...

setting strings in gdb

c++: int main() { string a = "a"; ... ... } when i debug in gdb: (gdb) set var a = "ok" Invalid cast I run the program and pause at a break point after string a has been ...

How to debug programms written in fasm under linux using gdb?

I wrote simple "hello, world" in fasm, and its works, but how i can generate debug info for gdb and edb (Evan s Debugger)? Fasm compiler could only produce debugging symbols in its specific format - "...

How can I display Unicode strings while debugging on linux?

I have been working for some years now as C++ Developer using MS Visual Studio as working platform. Since I privately prefer to use linux, I recently took the chance to move my working environment to ...

Continue to debug after failed assertion on Linux?

When an assertion fails with Visual C++ on Windows, the debugger stops, displays the message, and then lets you continue (or, if no debugging session is running, offers to launch visual studio for you)...

热门标签