On 08/18/2014 03:39 AM, Fabian Mager wrote:
Hello all,
I have two questions. Therefore, I uploaded a small mutatee
program(http://pastebin.com/1wsuSRmE) and the respective mutator program
(http://pastebin.com/KyXUC9mm). The output is the following:
> clang -Wall -g -O0 struct.c -o struct
> clang++ -Wall -g -O0 -std=c++11 procapi.cpp -I... -L... -lpcontrol
-lstackwalk -lsymtabAPI -o procapi
>./procapi
stack from bottom to top:
foo FP: 140736267700336 SP: 140736267700312
main FP: 140736267700336 SP: 140736267700320
__libc_start_main FP: 0 SP: 140736267700352
_start FP: 0 SP: 140736267700544
parameters:
s: s_t -- 8 Bytes
--> Setting size to 0
s: s_t -- 16 Bytes
greetings from foo!
Variable s of type struct s_t has a size of 16 Bytes on my system. I
don't understand why getSize() returns 8 Bytes on the first attempt and
after calling setSize(0), it returns the correct 16 Bytes. The sizes
vary a bit when using gcc instead of clang but they are still not equal.
Patch below; let me know if it works.
The second question focuses on the frame pointers (FP). foo and main
have the same FP but that should not be the case and causes troubles
when I later on try to get the actual parameter values with
getLocalVariableValue(). I assume the reason for that is the way I set
the breakpoint(process->addBreakpoint(f_foo->getOffset(), breakpoint)).
How do I set the breakpoint to the beginning of the function call?
If you're trying to get parameter values, you need to do that inside an
address range where the DWARF information we have for them is valid.
That's generally going to be after stack frame setup, which is a few
instructions into the function, for anything that's not passed in a
register.
If you look at the variable locations of the parameters, they should
have address ranges attached to them, and you should be able to set your
breakpoint at the beginning of the valid range with no problem.
_______________________________________________
Dyninst-api mailing list
Dyninst-api@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api
--
--bw
Bill Williams
Paradyn Project
bill@xxxxxxxxxxx
diff --git a/symtabAPI/src/Type.C b/symtabAPI/src/Type.C
index 302a99d..a68f718 100644
--- a/symtabAPI/src/Type.C
+++ b/symtabAPI/src/Type.C
@@ -197,7 +197,8 @@ bool Type::operator==(const Type &otype) const
unsigned int Type::getSize()
{
- if (!size_)
+ // If default constructed, update
+ if (!size_ || (size_ == sizeof(int)))
const_cast<Type *>(this)->updateSize();
return size_;
}
|