This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: breakpoint for accessing memory location


Eli Zaretskii wrote:

What text would you suggest to have there that would have helped you recognize that this is the feature you wanted? If you were looking for some specific words or phrases, please tell what they are. This will allow us to improve the manual.


OK, I was led off the track by the word "expr" without there being an explanation of its use, which may be quite powerful and encompass a diversity which the mere mentioning of the single word "expr" fails to express.


Below you find how I failed to see its usefulness and a beginning of a formulation that would have prevented me from missing it.


Actually I was prepared to find a feature like "setting a watch on something", which interrupts program execution as soon as the value for "something" changes. So, the term watchpoint is not the problem (it is one of the things I tried in the first place).


The reasons for missing its usefulness are:
1. From previous experience (I believe I derive that from a Turbo Pascal IDE compiler/debugger) I knew a feature that sets a watchpoint on a *variable*. However, the manual mentions an "expr" to watch for. An "expr" is more abstract, but probably includes variables.


2. I tried to set a watch on the memory address of the variable that was giving me trouble (this appeared not to be very useful as Daniel pointed out, but that's beside the point now).
The reason I tried such a less useful thing also lies in the fact that "expr" can mean a lot, and one has to devise an interpretation for it oneself. The diversity of the possible interpretations of "expr" isn't worked out in a set of examples.


3. My experiment with a fixed memory address failed. That's when I reverted to breakpoints, which (of course) is not what I was looking for.

4. I sought help in this mailing list (thanks again).

So, to summarize a long story:

"expr" can mean a lot of different things, but programmers that are new to debugging, or new to gdb will not have much idea about useful interpretations of that term. If no words are spent on an explanation of the power of this single word then users may get lost.


As for a recommended formulation, well, something along the lines of:


watch expr
Set a watchpoint for an expression. GDB will break when expr is
written into by the program and its value changes. Be aware that expr is a powerful construct that can be used to:
- indicate a variable: [include a reference to an example]
- a value at a specific memory address (without a variable needing to reference it): [include a reference to an example]
- other useful interpretations that I don't see right now ...


Please feel free to adapt from this suggestion, since it should be clear that I don't oversee the extent to which expr may be usefully interpreted in this case.

Sincerely,

Erik Leunissen




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]