DeBUG  with GDB


                            TIPS & TRICKS:

                                                                                                                                                                        << CONTENTS >>
                                  1>   Redirection of GDB input's & output's to a log file

    1. $script <log-file-name>
        $gdb
        gdb> end
       
       Log-file contains ^M to notify the line termination.
       After the GDB work completion kill the script process.
       kill -9 `ps -ae | grep script | awk '{pprint $1}'`
   
    2. $gdb | tee <log-file-name>
      
       It will be automatically terminated at the end of gdb session.  

                                  2>    GDB commands lists
                               
                                        (gdb) complete
                                        It will give all the command lists.
                                        GDB is pattern recognisable debugger program.compl (or) comple (or) complet
                                        is used to do the functionality of complete command

                                  3>   GDB commands search

                                        (gdb> aporpos <STRING PATTERN>
                                         Search for commands matching a REGEXP

                                  4>    Shell commands execution

 (gdb) shell <command> <string>
 Invoke a standard shell to execute command string.
 If it exists, the environment variable SHELL determines which shell to run.
 Otherwise GDB uses the default shell "/bin/sh"

 shell - she | shel | shell (pattern recognisable commands)
 <Example> (gdb) shell clear
  clears the window

                                 5>    Machine Architecure
           
                                        (gdb) info architecture
                                        It will give the architecture information

                                 6>    GDB settings
                                   
                                        (gdb) info set
                                        It will give all the GDB settings

                                  7>    Running file Debugging

    To debug the running file with it's process-ID use
    ( gdb ) attach <process-id-of-the-running-file>
   
    Get the process id with
    < ps -ae | grep <file-name>|awk '{print $1}' >
   
    To remove the file from being debugged
    ( gdb ) detach

                                  8>   Make execution   

                                            (gdb) make make-args

                                            Execute the make program with the specified arguments.
                                            This is equivalent to `shell make make-args'.

                                  9>   Prompt change settings:

                                             (gdb) set prompt test
                                              set prompt will set the gdb prompt name ( For that session only )
                                              (test)

                                  10>   To make gdb with some default settings:

                                              Use ".gdbinit" file on the path of execution of gdb with your settings as like,

                                                    ----------   .gdbinit    ------------
                                                    set prompt test
                                                    define clr
                                                    shell clear
                                                    end
                                                    document  clr
                                                    It is used to clear gdb session messages
                                                    end
                                                    ---------------------------------------



           TIP's and TRICK's                                                                 Muthukumar Kandasamy <[email protected]>

Hosted by www.Geocities.ws

1