Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > multiple statements in the debugger

Reply
Thread Tools

multiple statements in the debugger

 
 
avilella@gmail.com
Guest
Posts: n/a
 
      06-14-2006
Hi all,

I am using the perl debugger under Emacs, and for a long time I have
wondered if
there is a way to do trigger more than one statement at the same line.

For example:

Let's say I have a breakpoint at a place in my code, and at some point
I want to do a:

DB<2> c

and after that I want to print the contents of something, like:

DB<2> x @foo

and I want to do this all over again, and again.

Is there a way to do that in one line?

Something like:

DB<2> c ; x @foo

At some point, then I will be able to do something like:

DB<2> c ; x @foo; c ; x @foo2; c x @foo3 ; c; x @foo4; n; x @bar; n; n;
x @bar2

or anything more complicated...

I'm sure there is a Perl/Emacs guru out there that knows how to do
that, in a way or another.

Thanks in advance,

Bests,

Albert.

 
Reply With Quote
 
 
 
 
Xicheng Jia
Guest
Posts: n/a
 
      06-14-2006
wrote:
> Hi all,
>
> I am using the perl debugger under Emacs, and for a long time I have
> wondered if
> there is a way to do trigger more than one statement at the same line.
>
> For example:
>
> Let's say I have a breakpoint at a place in my code, and at some point
> I want to do a:
>
> DB<2> c
>
> and after that I want to print the contents of something, like:
>
> DB<2> x @foo
>
> and I want to do this all over again, and again.
>
> Is there a way to do that in one line?
>
> Something like:
>
> DB<2> c ; x @foo
>
> At some point, then I will be able to do something like:
>
> DB<2> c ; x @foo; c ; x @foo2; c x @foo3 ; c; x @foo4; n; x @bar; n; n;
> x @bar2


Don't think you can make it this way. but if you want to get something
like "disp" in "gdb", you may want to use action 'a' or sometimes
watchpoint 'w'. for example, you set a break point at line-32.

DB<2> b 32
DB<3> a 32 print map "$_\n" @foo;

then every time your code runs pass this line-32, @foo will be printed
out automatically..you can set and unset multiple actions at the same
break point, but you can not use the debug-command 'x' to dump the
results, so it's not good for some complex data structures. a
workaround is:

perl -MData:umper -d yourcode.pl

(dont know how you can do it in emacs though), and then

DB<3> a 32 print Dumper \@foo;

Another way I know is you can set a debug-command to be executed after
every "n", "s", "c", "r"......commands by the following way:

DB<2> { x \@foo

then every time after you type "n", "s", "c"...... you will get the
results of @foo.. But I guess this is not what you wanted.

XC

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
if statements and case statements questions John Crichton Ruby 6 07-12-2010 06:17 PM
Prepare Statements VS Statements Vince Java 12 01-21-2008 01:18 PM
component statements within architecture statements Neil Zanella VHDL 8 10-20-2006 09:05 AM
multiple statements in the debugger avilella@gmail.com Perl Misc 0 06-14-2006 09:05 PM
if statements with or w/o else statements Harry George Python 6 02-23-2004 06:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57