toppin@melpar.UUCP (Doug Toppin) (10/27/89)
I use adb fairly often and have been unable to do something that
is touched on in the manual. I want to set a breakpoint and have
a variable printed out every time the breakpoint is reached
but I don't want execution to stop at the breakpoint. Every manual
I have seen has implied this is possible with the following sentence
in explaining the ':br' command:
"If this command sets dot to zero then the breakpoint causes a stop."
I read this as saying that if I do something that does not set dot
to zero then execution will continue. For example:
int i;
main()
{
for(i=0; i<100; i++);
}
If, under adb, I set a breakpoint at the appropriate address and tell it
to print 'i' it seems to me that it should continue. For example:
(note that the instruction address will probably differ on your system)
main+37:br i/u
If I print dot after stopping it is not zero, do I have to do something
else in the command?
If anyone knows what I am doing wrong please let me know, this is something
I have wondered about for a long time. I'm running SCO Xenix on the 386.
thanks
Doug Toppin
uunet!melpar!toppin
chris@mimsy.umd.edu (Chris Torek) (10/27/89)
In article <240@melpar.UUCP> toppin@melpar.UUCP (Doug Toppin) writes: >[the manual] implied this is possible with the following sentence >in explaining the ':br' command: >"If this command sets dot to zero then the breakpoint causes a stop." >I read this as saying that if I do something that does not set dot >to zero then execution will continue. The manual is misleading. (I will go edit the 4.4BSD version.) adb stops when: o the count runs out; or o the command is empty; or o the command sets dot to zero. Thus, to set a breakpoint that runs `forever': main+17,0:b <r0=D;1 `main+17' is the address of the breakpoint. `0' as a count is the nearest thing adb has to `infinity'. Since `<r0' sets dot to whatever is in r0, I appended the command `1' (semicolons separate multiple commands). Note that, e.g., foo+12,8:b this/X will print `this' 8 times, and then stop, when run via `:r', but will print it 16 times, and then stop, when run via `,2:r'. The new manual wording is (/x/ indicates italics): :b/c/ Set breakpoint at /address/. The breakpoint is executed /count/-1 times before causing a stop, after which it stops unconditionally. Each time the breakpoint is encountered the command /c/ is executed. If this command is omitted or sets /dot/ to zero, the breakpoint causes a stop immediately, regardless of any remaining count. Still perhaps overly concise, but less ambiguous. -- `They were supposed to be green.' In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris