Frank Ch. Eigler wrote:
Yoav Etsion <[EMAIL PROTECTED]> writes:
The pointer variable's address is used as the pointer's unique ID in
a database, collecting information about each pointer variable -
mostly its legal bounds. That way I can test when a pointer crosses
its object's bounds.
...
But I may misunderstand the nature of checking you intend. Could you
summarize your intended overall algorithm?
(I'll answer this first, hoping it will also answer the previous two
comments)
My approach is simple: during dereference we have to check whether the
pointer points within its legal boundaries, which should be those of the
object assigned to it before any pointer arithmetic.
Question is how do we know what the legal boundaries are, as pointer
arithmeric might have caused our pointer to jump into an adjacent object?
Now, think of the boundaries as attributes that can only change in
pointer assignments (not arithmetic). We need to keep a database mapping
pointers to boundaries, that is updated with each pointer assignment.
So the three operations I need to intercept are pointer dereferences
(code which already exists in mudflap2), pointer assignments, and
pointer declarations to get the variable's address as the unique
database ID (my current predicament). Since I assume automatically
generated variables do not induce bugs (hopefully) I don't have to track
them (come to think of it, maybe I can do with only assignments and
dereferences).
Using such database I can both check bounds, and more important to my
current research to better understand programming habits and pointer flow.
Hope this clears things up, and obviously any comments and suggestions
are more than welcome.
Yoav
- FChE