Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Using Perl to automate GDB

by eloc (Initiate)
on Jul 28, 2014 at 23:46 UTC ( [id://1095448]=perlquestion: print w/replies, xml ) Need Help??

eloc has asked for the wisdom of the Perl Monks concerning the following question:

Monks, I humbly come before seeking your great wisdom. I essentially want to use Perl to send input commands to GDB, read the output GDB supplies from these commands, and based on that output send more commands to GDB. I believe open2() or open3() may be of use to me. Is this possible? If so could you show me a simple example? However, I am new to Perl, and would deeply appreciate any examples or advice you can provide.

Replies are listed 'Best First'.
Re: Using Perl to automate GDB
by Anonymous Monk on Jul 28, 2014 at 23:55 UTC

    Hello eloc, how new to Perl are you? If you're completely new to Perl then diving directly into something like GDB might be a pretty big challenge to start with, and you'd probably want to start with perlintro and/or a good book first.

    Anyway, a quick search brings up Devel::GDB, the description of which sounds like what you want to do.

Re: Using Perl to automate GDB
by LanX (Saint) on Jul 28, 2014 at 23:56 UTC
    > send input commands to GDB read the output GDB ...

    You are talking about the GNU Debugger right?

    Such tools have an interface to be remote controlled by GUIs or IDEs like emacs.

    I'd rather try to find out about this than redirecting STDOUT and STDIN manually.

    Cheers Rolf

    (addicted to the Perl Programming Language and ☆☆☆☆ :)

Re: Using Perl to automate GDB
by aitap (Curate) on Jul 29, 2014 at 08:50 UTC
    Read Bidirectional Communication with Another Process carefully (don't get in the situation when both programs wait for input from the other side), then proceed with examples from CPAN module IPC::Run which provides a comfortable interface to bidirectional interaction with programs.
Re: Using Perl to automate GDB
by rovf (Priest) on Jul 29, 2014 at 06:00 UTC
    How about using Net::Telnet? This module is usually used to connect to a different host using telnet, and remote control the programs (send commands, grab their output), but you can of course remote control localhost too.

    -- 
    Ronald Fischer <ynnor@mm.st>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1095448]
Front-paged by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-20 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found