Re: Symbols/blocks questions

Jerome Guitton
2009-09-22T09:47:25Z

Joel Brobecker (brobecker@adacore.com):

> Jerome Guitton had a serious look at how things are done when
> decoding breakpoint locations, mostly because we wanted Ada and C++
> to use the same code for multiple-location breakpoints. I'll ask him
> to see there is any useful piece of information that might help answer
> these questions.

Not much to add to what Matt already said; and my knowledge in this
area have seriously decreased. I will tell you what I *think* I know.

IIRC, if decode_line_1 returned more than one line, multiple
breakpoints would be created (not a multiple-location
breakpoint). Precisely what happens for overloaded functions: multiple
breakpoints are created. See test ovldbreak.exp.

IIUC, multiple-location breakpoints are only used when the same
"location expression" (addr_string) has to be used to identify a set of
breakpoints; so that, at breakpoint re-set, the same addr_string can
be used to re-create the whole set of sub-breakpoints.

So, I *assume* that if decode_line_1 returns more than one location,
each of these locations has to refer to a different source location;
they should not have the same addr_string. If the same addr_string was
used for such breakpoints, the breakpoint reset would call
decode_line_1 for each of them, find several instances for each of
them, and create duplicates.

Let me give an example from my experience of the problem. In AdaCore's
debugger, we have a feature that allows the user to select a few
choices from the list of all locations that corresponds to a FILE:LINE
expression. Say, if the user set a breakpoint in a generic, the
debugger asks him on which instances breakpoints should be created,
and this user can select several choices in the list. Now, to avoid
having the re-set problem, the debugger has to rewrite the addr_string
to a sort of "canonical" location. If multiple locations are found for
FILE:LINE, say, in Func1 and Func2, then two breakpoints are set in
Func1:FILE:LINE and Func2:FILE:LINE. That's the kind of things that
you have to do when decode_line_1 returns more than 1 location...