开发者

Function name and address missing from Linux System.map

开发者 https://www.devze.com 2022-12-20 14:34 出处:网络
I am doing embedded development on an AT91SAM9263 board and running into a strange problem.It is running debian Linux kernel 2.6.18.4 and is cross-compiled with arm-l开发者_如何转开发inux-gcc 3.4.6 an

I am doing embedded development on an AT91SAM9263 board and running into a strange problem. It is running debian Linux kernel 2.6.18.4 and is cross-compiled with arm-l开发者_如何转开发inux-gcc 3.4.6 and uses uClibc-0.9.28 for the C library. I am debugging a kernel device driver and a specific function is not appearing in the System.map file. Understandably, I can therefore not set a breakpoint on it. Oddly, if I break into its calling function, I cannot step into it - using the nexti command of gdb executes it but skips past the source. The function is atmel_rx_chars(struct uart_port *port). It is a static void function declared in atmel_serial.c, an example of which appears at [1]. There are other static void functions in the same file (atmel_tx_chars(struct uart_port *port), for example) which are declared in the same file and are in fact indexed in the System.map file. According to [2] "System.map is produced by 'nm vmlinux' and irrelevant or uninteresting symbols are grepped out." I have tried using nm (as well as objdump) to view all symbols and it still does not appear in the output. However, when I grep atmel_rx_chars vmlinux it returns a match. I used to consider myself a bit of a power user but after this I am truly stumped. Any advice would be most appreciated.

Thank you,

Jayce

[1] http://lxr.free-electrons.com/source/drivers/serial/atmel_serial.c#L379

[2] http://www.faqs.org/docs/Linux-HOWTO/Kernel-HOWTO.html#systemmap


The reason you don't see it is because the compiler is inlining that function. It's declared static and only called in one place so the compiler inlines it. If you want to put a breakpoint on it, change the source so it's no longer declared static and recompile.


For anyone who may be interested, I could not figure out why it does not map atmel_rx_chars to an address in System.map. You can still set a breakpoint as normal in order to debug in this situation. I suppose it should have been more obvious when I was searching for answers. Anyway in the gdb command line type

b source_file.c:line#

so in this example, it would be

b atmel_serial.c:381

and it will break whenever you hit the "missing" routine. This is still an incomplete solution, though. Breaking into a specific line works but it doesn't leave the stack frame of the calling function (atmel_handle_receive), so locals of atmel_rx_chars are inaccessible to gdb. As always, any help or insight would be appreciated. Hope this serves as a good jumping off point if someone else ever runs into this problem or one like it.

Thank you,

Jayce

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号