How to use symbols in bochs?
How to use symbols in bochs?
When I try to debug my os, I always need to set breakpoint in many place to find the right function that I am goint to debug. Is there any way to let bochs load the symbols? And Is there any way to let gdb/nasm to generate the right symbols? For example, I have two files, kernel.asm will be loaded to 0x0008: 0x9000h, main.c will be loaded to 0x0008:8000h, both in realmode. How can I set the gdb/nasm to generate the right symbols to let bochs to load?
-
- Member
- Posts: 510
- Joined: Wed Mar 09, 2011 3:55 am
Re: How to use symbols in bochs?
Not that I know of. However, you might want to look up the bochs magic breakpoint, and breakpoints in bochs in general.MarkZar wrote:When I try to debug my os, I always need to set breakpoint in many place to find the right function that I am goint to debug. Is there any way to let bochs load the symbols?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: How to use symbols in bochs?
People, please, learn to read the manual
ldsym [global] filename [offset]
Load symbols from file filename. If the global keyword is added, then the the symbols will be visible in all contexts for which symbols have not been loaded. Offset (default is 0) is added to every symbol entry. The symbols are loaded in the current (executing) context.
Re: How to use symbols in bochs?
Hi everybody.
I have problems to generate the symbol file.
I used next commands to generate and probe them with bochs, but I got the same error:
>$ objcopy --only-keep-debug kernel kernel.sym
and
>$ objcopy --extract-symbol kernel kernel.sym
from internal bochs' debugger I get the next:
<bochs:1> ldsym global "kernel.sym"
kernel.sym:1: syntax error near 'ELF'
I'm using GAS assembler and C, and I have several files in different diretories.
forget I something?
I have problems to generate the symbol file.
I used next commands to generate and probe them with bochs, but I got the same error:
>$ objcopy --only-keep-debug kernel kernel.sym
and
>$ objcopy --extract-symbol kernel kernel.sym
from internal bochs' debugger I get the next:
<bochs:1> ldsym global "kernel.sym"
kernel.sym:1: syntax error near 'ELF'
I'm using GAS assembler and C, and I have several files in different diretories.
forget I something?
Re: How to use symbols in bochs?
lcjuanpa wrote:from internal bochs' debugger I get the next:
<bochs:1> ldsym global "kernel.sym"
kernel.sym:1: syntax error near 'ELF'
Maybe you should read the document, as Combuster said.From 8.12. Using Bochs internal debugger wrote: The symbol file consists of zero or more lines of the format
"%x %s"
Re: How to use symbols in bochs?
something like this is useful:
Code: Select all
#!/bin/sh
nm $1 | grep " T " | awk '{ print $1" "$3 }' > $1.sym
Learn to read.
Re: How to use symbols in bochs?
Thanks a lot dozniak
Maybe my question should be more explanatory (of course I read the manual linked by combuster).
Maybe my question should be more explanatory (of course I read the manual linked by combuster).
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: How to use symbols in bochs?
Reading then deliberately ignoring everything the manual said doesn't count - see the comments above.
Re: How to use symbols in bochs?
Just as a comment:
The command:
> $ objcopy --only-keep-debug kernel kernel.sym
generate a binary file and the dozniak's script
#!/bin/sh
nm $1 | grep " T " | awk '{ print $1" "$3 }' > $1.sym
generate a text file.
Maybe in the manual of bochs should be appear that filename is a text file (if I'm not wrong) and "%x %s" represent an address and a symbol.
Sometimes one trust in the result of the tools that one have. Sometimes one doesn't understand the same things in the same way.
The command:
> $ objcopy --only-keep-debug kernel kernel.sym
generate a binary file and the dozniak's script
#!/bin/sh
nm $1 | grep " T " | awk '{ print $1" "$3 }' > $1.sym
generate a text file.
Maybe in the manual of bochs should be appear that filename is a text file (if I'm not wrong) and "%x %s" represent an address and a symbol.
Sometimes one trust in the result of the tools that one have. Sometimes one doesn't understand the same things in the same way.