How to debug ash_main function in the ash.c by gdb?

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Wed Jun 10 08:19:39 UTC 2009


On Wed, Jun 10, 2009 at 02:57:51PM +0800, ruifeng yang wrote:
>Hello everyone:
>     I am reading the busybox's sources,the busybox version is 1.13.4.
>     I want to debug the int ash_main(int argc UNUSED_PARAM, char **argv)
>function,
>     How to do it?

you would run
$ busybox_unstripped ash
i.e. with arg "ash", thus:
$ gdb -q busybox_unstripped
(gdb) b ash_main
(gdb) run ash
>
>     [root at beijing2008 busybox-1.13.4]# gdb busybox_unstripped
>     (gdb) b ash_main
>      Breakpoint 1 at 0x805497e: file shell/ash.c, line 13735.
>     (gdb) run
>     Starting program: /home/yrff/cli/busybox-1.13.4/busybox_unstripped

HTH,


More information about the busybox mailing list