This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Add support for tracking/evaluating dwarf2 location expressions
- To: Daniel Berlin <dberlin at redhat dot com>
- Subject: Re: [PATCH] Add support for tracking/evaluating dwarf2 location expressions
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Fri, 30 Mar 2001 18:36:37 -0500
- Cc: gdb-patches at sources dot redhat dot com
- References: <Pine.LNX.4.33.0103301400270.24037-100000@www.cgsoftware.com>
Dan, just some things to tweek,
State machines are normally implemented using a switch and not a chain
of ifs. Check dwarf2read.c:decode_locdesc() as an example (hmm, slight
dejavu :-).
While fall through switches such as:
+ /* Determine the size to read, and whether it's signed or
+ not */
+ switch (op)
+ {
+ case DW_OP_const1s:
+ sign = 1;
+ case DW_OP_const1u:
+ readsize = 1;
+ break;
might be cute they tend to make the life of those that follow painful.
As they say, dumb the code down.
Don't forget ``a = b'' not ``a=b''.
Just use ``struct value *'', I've every intention of zapping
``value_ptr''! :-)
value_ptr stack[64];
Is there a constant for this? A quick glance at decode_locdesc() and it
has the same hardwired constant.
>From memory, the dwarf2 state machine doco states that you should return
the top-of-stack when the machine has finished executing. This means
that the stack may not be empty and that the code could potentially leak
``struct value *''s.
enjoy,
Andrew