Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lldb] Add isConstant mode for FA locations #110726

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lldb/include/lldb/Symbol/UnwindPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ class UnwindPlan {
isRegisterDereferenced, // FA = [reg]
isDWARFExpression, // FA = eval(dwarf_expr)
isRaSearch, // FA = SP + offset + ???
isConstant, // FA = constant
};

FAValue() : m_value() {}
Expand Down Expand Up @@ -259,6 +260,15 @@ class UnwindPlan {
m_value.expr.length = len;
}

bool IsConstant() const { return m_type == isConstant; }

void SetIsConstant(uint64_t constant) {
m_type = isConstant;
m_value.constant = constant;
}

uint64_t GetConstant() const { return m_value.constant; }

uint32_t GetRegisterNumber() const {
if (m_type == isRegisterDereferenced || m_type == isRegisterPlusOffset)
return m_value.reg.reg_num;
Expand Down Expand Up @@ -329,6 +339,8 @@ class UnwindPlan {
} expr;
// For m_type == isRaSearch
int32_t ra_search_offset;
// For m_type = isConstant
uint64_t constant;
} m_value;
}; // class FAValue

Expand Down
4 changes: 4 additions & 0 deletions lldb/source/Symbol/UnwindPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ operator==(const UnwindPlan::Row::FAValue &rhs) const {
return !memcmp(m_value.expr.opcodes, rhs.m_value.expr.opcodes,
m_value.expr.length);
break;
case isConstant:
return m_value.constant == rhs.m_value.constant;
}
}
return false;
Expand Down Expand Up @@ -214,6 +216,8 @@ void UnwindPlan::Row::FAValue::Dump(Stream &s, const UnwindPlan *unwind_plan,
case isRaSearch:
s.Printf("RaSearch@SP%+d", m_value.ra_search_offset);
break;
case isConstant:
s.Printf("0x%" PRIx64, m_value.constant);
}
}

Expand Down
6 changes: 6 additions & 0 deletions lldb/source/Target/RegisterContextUnwind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2088,6 +2088,12 @@ bool RegisterContextUnwind::ReadFrameAddress(
UnwindLogMsg("No suitable CFA found");
break;
}
case UnwindPlan::Row::FAValue::isConstant: {
address = fa.GetConstant();
address = m_thread.GetProcess()->FixDataAddress(address);
UnwindLogMsg("CFA value set by constant is 0x%" PRIx64, address);
return true;
}
default:
return false;
}
Expand Down
Loading