Find the answer to your Linux question:
Results 1 to 6 of 6
I am using Red Hat Enterprise Linux Server release 5.4. I need to add new commands to GDB. Where can I find the codes for those commands and how to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2013
    Posts
    3

    How to add new commands to GDB?


    I am using Red Hat Enterprise Linux Server release 5.4. I need to add new commands to GDB. Where can I find the codes for those commands and how to add these commands to GDB?
    Please help

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,380
    Are you talking about user-defined commands? What do you need to do? Execute the command "info gdb" and go to section 23.1.1 User-defined Commands. It tells you how to create your own commands and has some maybe useful examples.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Mar 2013
    Posts
    3
    Thanks for your reply
    But we did not find section 23.1.1
    Can you please suggest some other solution

    Thanks in advance!!

  4. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,345
    Documentation and section 23.1.1 is also available online
    Define - Debugging with GDB
    You must always face the curtain with a bow.

  5. #5
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,757
    Quote Originally Posted by shalini_ellinthala View Post
    Where can I find the codes for those commands
    Why do you need source code of commands ? Could you please explain little more about your requirement? Do you want do add new feature to GDB binary itself?
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  6. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,380
    Code:
    File: gdb.info,  Node: Extending GDB,  Next: Interpreters,  Prev: Controlling GDB,  Up: Top
    
    23 Extending GDB
    ****************
    
    GDB provides two mechanisms for extension.  The first is based on
    composition of GDB commands, and the second is based on the Python
    scripting language.
    
       To facilitate the use of these extensions, GDB is capable of
    evaluating the contents of a file.  When doing so, GDB can recognize
    which scripting language is being used by looking at the filename
    extension.  Files with an unrecognized filename extension are always
    treated as a GDB Command Files.  *Note Command files: Command Files.
    
       You can control how GDB evaluates these files with the following
    setting:
    
    `set script-extension off'
         All scripts are always evaluated as GDB Command Files.
    
    `set script-extension soft'
         The debugger determines the scripting language based on filename
         extension.  If this scripting language is supported, GDB evaluates
         the script using that language.  Otherwise, it evaluates the file
         as a GDB Command File.
    
    `set script-extension strict'
         The debugger determines the scripting language based on filename
         extension, and evaluates the script using that language.  If the
         language is not supported, then the evaluation fails.
    
    `show script-extension'
         Display the current value of the `script-extension' option.
    
    
    * Menu:
    
    * Sequences::          Canned Sequences of Commands
    * Python::             Scripting GDB using Python
    Code:
    File: gdb.info,  Node: Sequences,  Next: Python,  Up: Extending GDB
    
    23.1 Canned Sequences of Commands
    =================================
    
    Aside from breakpoint commands (*note Breakpoint Command Lists: Break
    Commands.), GDB provides two ways to store sequences of commands for
    execution as a unit: user-defined commands and command files.
    
    * Menu:
    
    * Define::             How to define your own commands
    * Hooks::              Hooks for user-defined commands
    * Command Files::      How to write scripts of commands to be stored in a file
    * Output::             Commands for controlled output
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •