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

ruifeng yang yrffren at gmail.com
Wed Jun 10 06:57:51 UTC 2009


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?

     [root at beijing2008 busybox-1.13.4]# gdb busybox_unstripped
     GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
     Copyright 2003 Free Software Foundation, Inc.
     GDB is free software, covered by the GNU General Public License, and
you are
     welcome to change it and/or distribute copies of it under certain
conditions.
     Type "show copying" to see the conditions.
     There is absolutely no warranty for GDB.  Type "show warranty" for
details.
     This GDB was configured as "i386-redhat-linux-gnu"...
     (gdb) list
     759     #endif /* !defined(SINGLE_APPLET_MAIN) */
     760
     761
     762
     763     #if ENABLE_BUILD_LIBBUSYBOX
     764     int lbb_main(char **argv)
     765     #else
     766     int main(int argc UNUSED_PARAM, char **argv)
     767     #endif
     768     {
     (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
     BusyBox v1.13.4-200906081408 (2009-06-10 14:48:31 CST) multi-call
binary
     Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
     and others. Licensed under GPLv2.
     See source distribution for full notice.

     Usage: busybox [function] [arguments]...
        or: function [arguments]...

             BusyBox is a multi-call binary that combines many common Unix
             utilities into a single executable.  Most people will create a
             link to busybox for each function they wish to use and BusyBox
             will act like whatever it was invoked as!

     Currently defined functions:
             ash, cttyhack, sh


     Program exited normally.
     (gdb)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090610/5060a11d/attachment-0001.htm>


More information about the busybox mailing list