Speaking of debuggers.... (was RE: looking for a program)
Lucas Vogel
lvogel@exponent.com
Wed, 7 Feb 2001 08:15:37 -0800
For those of you who haven't gotten this month's issue of Dr. Dobb's yet,
there is a great article on ddd, a visual GNU debugger. Besides GDB, DDD
supports DBX, JDB, XDB, WDB, the Perl debugger, and a variant of the Python
debugger.
the article:
http://www.ddj.com/articles/2001/0103/0103a/0103a.htm
-----Original Message-----
From: der.hans [mailto:PLUGd@LuftHans.com]
Sent: Tuesday, February 06, 2001 11:39 PM
To: plug-discuss@lists.PLUG.phoenix.az.us
Subject: Re: looking for a program
Am 06. Feb, 2001 schwäzte Kevin Buettner so:
Kevin,
you're posts are just *too* cool! :)
Now since I don't use debuggers other than those that have been blessed by
Linus, e.g. print statements :), I don't know the intricacies of gdb.
Since you're basically throwing it a line of code in a command line type
of way it seems like you kind of have a shell for c/c++ and whatever else
gdb understands. Is that somewhat correct?
If so, can you toss it a few lines of code, specifically a loop or other
control block to test it out. Sort of like a "for i in ..." construct from
a shell command line?
Can you include files, then run stuff?
I'm starting to look at c stuff again ( that's what I'm planning for my
spare nano-second this year ;-), so if I could do some of those stupid
shell tricks from a c 'command line' I could practice doing them in c :).
ciao,
der.hans
> On Feb 6, 6:03pm, Lucas Vogel wrote:
>
> > I'm looking for a program that will take either a decimal, hex or octal
> > input and give me its decimal, hex or octal output. Can anyone tell me
what
> > I'm looking for?
>
> Like others who've answered, the first thing I thought of was
> Perl...
>
> saguaro:kev$ perl -e 'printf "%x\n", 42'
> 2a
> saguaro:kev$ perl -e 'printf "%d\n", 0x2a'
> 42
> saguaro:kev$ perl -e 'printf "%o\n", 0x2a'
> 52
> saguaro:kev$ perl -e 'printf "%d\n", 052'
> 42
>
> But gdb works good for this purpose too...
>
> saguaro:kev$ gdb
> GNU gdb 5.0
> [...]
> (gdb) print/x 42
> $1 = 0x2a
> (gdb) print 0x2a
> $2 = 42
> (gdb) print/o 0x2a
> $3 = 052
> (gdb) print 052
> $4 = 42
> (gdb)
>
> gdb makes a pretty good calculator too...
>
> (gdb) print/x 6*7
> $5 = 0x2a
> (gdb) print $5/7
> $6 = 6
> (gdb) print $5+$6
> $7 = 48
>
> And for you C/C++ programmers out there...
>
> (gdb) print &((int *) 0)[4]
> $8 = (int *) 0x10
> (gdb) print/d &((int *) 0)[4]
> $9 = 16
>
> (This'd be the byte offset of the fourth element in an int array. Of
> course, the results are target dependent.)
>
> Kevin
>
> ________________________________________________
> See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't
post to the list quickly and you use Netscape to write mail.
>
> Plug-discuss mailing list - Plug-discuss@lists.PLUG.phoenix.az.us
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>
--
# der.hans@LuftHans.com home.pages.de/~lufthans/
www.YourCompanyHere.net ;-)
# Stell dir vor, es ist Krieg und keiner geht hin...
________________________________________________
See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't post
to the list quickly and you use Netscape to write mail.
Plug-discuss mailing list - Plug-discuss@lists.PLUG.phoenix.az.us
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss