Hello,
I'm hitting my head against a wall on this. Can you please help?
I am debugging a program with gdb (5.2-2) and wish to break when the
contents of a particular memory location are changed. I have some
pointer in a local procedure (it's a callback, actually), and I want
to know where else, in one of many supporting libraries, the pointer
is changed.
Specifically, there's a struct with a member called 'data" that is a
char pointer. "data" gets released somewhere, and reallocated, and
somewhere else is writing data into it; I want to know what portion of
the code is doing the allocating and what other portion is doing the
writing.
I tried "awatch 0x1234" where 0x1234=&(thing.data) but I get an error
message, "Expression cannot be implemented with read/access
watchpoint." Same thing if I try "awatch &(thing.data)" or "awatch
&(thing.data[0])."
Another post by Marc Tardif [2000] discussed this same question, and I
tried the answer but it didn't work for me, nor does it make much
sense. Can some debugger type help me?
Thanks,
Russ Fink
References -
[2000] Marc Tardif (intmktg@Gloria.CAM.ORG), "breaking on memory
location", comp.unix.programmer, Dec 12, 2000, msgid:
<Pine.LNX.4.10.10012121756010.8735-100000@Gloria.CAM.ORG>
|
|
0
|
|
|
|
Reply
|
russfink
|
10/3/2003 3:32:12 PM |
|
Russ Fink <russfink@hotmail.com> wrote:
> I tried "awatch 0x1234" where 0x1234=&(thing.data) but I get an error
> message, "Expression cannot be implemented with read/access
> watchpoint." Same thing if I try "awatch &(thing.data)" or "awatch
> &(thing.data[0])."
I think whats going on here is you are telling the debugger to stop
whenever the value 0x1234 changes. Well, thats a constant integer.
It doesn't change.
I think you have to coerce that 0x1234 into being a pointer and then
de-reference it like so:
awatch *((char *)0x1234)
at least this worked for me on gdb 5.2-2
consider using a pointer cast other than (char *) if thats
what you really want.
Chance
--
I used to think government was a necessary evil.
I'm not so sure about the necessary part anymore.
|
|
0
|
|
|
|
Reply
|
chance
|
10/3/2003 11:28:20 PM
|
|