Fix stack frame calculation bug

There were certain instances where the calculation of the stack frame
was incorrect, causing for garbage to be returned by a print command.
This commit is contained in:
Derek Parker
2015-01-16 15:30:22 -06:00
parent 87c3b0a7d3
commit 76076791b9
3 changed files with 5 additions and 13 deletions

View File

@ -157,15 +157,9 @@ func (frame *FrameContext) ExecuteUntilPC(instructions []byte) {
// We only need to execute the instructions until
// ctx.loc > ctx.addess (which is the address we
// are currently at in the traced process).
for frame.address != frame.loc && frame.buf.Len() > 0 {
for frame.address > frame.loc && frame.buf.Len() > 0 {
executeDwarfInstruction(frame)
}
// make sure we get the update cfa offset
cfa := frame.CFAOffset()
for ncfa := cfa; ncfa == cfa && frame.buf.Len() > 0; {
executeDwarfInstruction(frame)
ncfa = frame.CFAOffset()
}
}
func executeDwarfInstruction(frame *FrameContext) {