🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #346

Watchpoint advice wanted

#346
From: John R. Levine
Date: Wed, 24 Jan 1990 02:32
26 lines
1934 bytes
I am putting code into gdb to handle watchpoints, although the only machine I
plan to implement them for at this point is the 386 which makes it easy by
having hardware support.  It's no big deal to add code to the breakpoint
routines to store watchpoints in the same list as breakpoints and to handle
them, though there are a few tricky bits, e.g. seeing if you hit a watchpoint
while single stepping over a breakpointed instruction.

The problem arises in setting watchpoints on stack local variables.
Currently I just set them the same way I set them on static data, but that is
not very satisfactory for two reasons.  If you set them while a routine is
active, you get false hits after it returns and some other routine reuses the
same memory.  On the other hand, a routine is likely to be called with the
stack at various different places and the addresses of locals change every
time.  The right thing to do is to insert the watchpoint when the routine
is entered and remove it when the routine returns, but that is quite slow
if the routine is called very often.

Does anyone have any other inspirations about a good way to handle local
watchpoints?

(Yes, I'll send out the diffs, but at the moment it's too buggy to be of
much use to anyone.)
-- 
John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650
johnl@esegue.segue.boston.ma.us, {ima|lotus|spdcc}!esegue!johnl
"Now, we are all jelly doughnuts."
Technical Details
Message-ID: <1990Jan24.023228.12288@esegue.segue.boston.ma.us>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think!snorkelwacker!spdcc!esegue!johnl

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think!snorkelwacker!spdcc!esegue!johnl
From: johnl@esegue.segue.boston.ma.us (John R. Levine)
Newsgroups: gnu.gdb.bug
Subject: Watchpoint advice wanted
Message-ID: <1990Jan24.023228.12288@esegue.segue.boston.ma.us>
Date: 24 Jan 90 02:32:28 GMT
Reply-To: johnl@esegue.segue.boston.ma.us (John R. Levine)
Distribution: gnu
Organization: Segue Software, Cambridge MA
Lines: 26