Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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 (Prior) on Mar 09, 2004 at 18:16 UTC

    I'm sure it must be possible using, 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 - it may be related to the fact that I learnt TCL before perl, and had used expect extensively in that period.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2023-06-11 00:22 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (40 votes). Check out past polls.