Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Emacs, perldb - edit cmd line args from within

by Ray Smith (Beadle)
on Feb 15, 2006 at 13:01 UTC ( [id://530366]=perlquestion: print w/replies, xml ) Need Help??

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

I often use perldb within the Emacs editor to debug perl scripts. I can edit the perl code and, using the "R" command, re-run the script with the changes. However, I have not found a method for changing the perldb command line arguments and rerunning the script. I usually exit Emacs, restart Emacs, run perldb, reenter an often complicated, slightly modified script command line, reestablish any break points and run the script.

Is there any way, from within emacs, to modify the current perldb command line so as to enable rerunning one's script?

  • Comment on Emacs, perldb - edit cmd line args from within

Replies are listed 'Best First'.
Re: Emacs, perldb - edit cmd line args from within
by jmcnamara (Monsignor) on Feb 15, 2006 at 16:31 UTC

    As a workaround you could set a breakpoint on the first line in the program and then overwrite the @ARGV values manually:
    DB<1> x @ARGV 0 'bar' DB<2> $ARGV[0] = 'foo' DB<3> x @ARGV 0 'foo'

    --
    John.

      Your workaround is a good idea. The perldb command "R" does indeed automatically stop at the beginning so one can edit the contents of @ARGV. But it would be nice to work in the command line style, specially if one might be able to cut and past in a new command line. It seems strange that perldb allows you to make source code changes and restart and it doesn't support some hack to support updating the command line. I suppose one could create some sort of function that would populate @ARGS that could be invoked before continguing - e.g. > cmdfix("-foo bar") but that just doesn't seem very elegant.
Re: Emacs, perldb - edit cmd line args from within
by jonadab (Parson) on Feb 15, 2006 at 14:05 UTC
    I've not used perldb personally, but it looks like it's defined in gud.el (on my system, /usr/local/share/emacs/21.3/lisp/gud.el). Probably if you poke around in there you can find the interactive function you need to call to do this. I don't know enough about what perldb does to know which one it is.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-19 12:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found