[BREAKING CHANGE] Unwinding stops at the end

This introduces a breaking change: [undefined] was previously
represented by 0, and is now represented by
`numeric_limits<uintptr_t>::max()`
This commit is contained in:
Théophile Bastian 2018-05-16 16:51:01 +02:00
parent 209e668505
commit 6854eb56e4
2 changed files with 5 additions and 1 deletions

View file

@ -3,6 +3,7 @@
#include "settings.hpp"
#include <algorithm>
#include <limits>
using namespace std;
@ -161,7 +162,7 @@ static const char* ctx_of_dw_name(SimpleDwarf::MachineRegister reg) {
void CodeGenerator::gen_of_reg(const SimpleDwarf::DwRegister& reg) {
switch(reg.type) {
case SimpleDwarf::DwRegister::REG_UNDEFINED:
os << "0"; // FIXME do better?
os << std::numeric_limits<uintptr_t>::max() << "ull";
break;
case SimpleDwarf::DwRegister::REG_REGISTER:
os << ctx_of_dw_name(reg.reg)

View file

@ -224,6 +224,9 @@ bool unwind_context(unwind_context_t& ctx) {
uintptr_t tr_pc = ctx.rip - mmap_entry->beg;
ctx = fde_func(ctx, tr_pc);
if(ctx.rbp == 0 || ctx.rip + 1 == 0)
return false;
return true;
}