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

how to write a program to control gdb

by seanborland (Initiate)
on Feb 29, 2004 at 15:33 UTC ( #332644=perlquestion: print w/replies, xml ) Need Help??

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

I want to write a perl program to control gdb. i.e. the command is put into my program and then passed to gdb, and gdb's output is put into my program and then displayed. I use open2 but it can not fulfil my requirement. Can someone be kind enough to give some demo code? Thanks a lot.

Replies are listed 'Best First'.
Re: how to write a program to control gdb
by matija (Priest) on Feb 29, 2004 at 16:35 UTC
    I have two words for you: use Expect. Look at Expect module, and I'm willing to bet you will find it much easier to use than open2.
      thank you very much
Re: how to write a program to control gdb
by hv (Parson) on Mar 09, 2004 at 18:16 UTC

    I'm sure it must be possible using Expect.pm, but last time I tried this (a few years ago) I didn't get very far, and it seemed easiest to use Perl to glue a TCL-style expect script and do the post-processing, as in this script which I used to generate a labelled disassembly of one function of a program.

    I can't remember now what problems I had with Expect.pm - it may be related to the fact that I learnt TCL before perl, and had used expect extensively in that period.

    Hugo

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2021-10-18 16:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (74 votes). Check out past polls.

    Notices?