Skip to content

Commit 1815d07

Browse files
Merge pull request #9383 from felipepiovezan/felipe/cherry_pick_fa_location_constant
[lldb] Add isConstant mode for FA locations (llvm#110726)
2 parents 9ff3840 + 78410e7 commit 1815d07

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

lldb/include/lldb/Symbol/UnwindPlan.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ class UnwindPlan {
215215
isRegisterDereferenced, // FA = [reg]
216216
isDWARFExpression, // FA = eval(dwarf_expr)
217217
isRaSearch, // FA = SP + offset + ???
218+
isConstant, // FA = constant
218219
};
219220

220221
FAValue() : m_value() {}
@@ -259,6 +260,15 @@ class UnwindPlan {
259260
m_value.expr.length = len;
260261
}
261262

263+
bool IsConstant() const { return m_type == isConstant; }
264+
265+
void SetIsConstant(uint64_t constant) {
266+
m_type = isConstant;
267+
m_value.constant = constant;
268+
}
269+
270+
uint64_t GetConstant() const { return m_value.constant; }
271+
262272
uint32_t GetRegisterNumber() const {
263273
if (m_type == isRegisterDereferenced || m_type == isRegisterPlusOffset)
264274
return m_value.reg.reg_num;
@@ -329,6 +339,8 @@ class UnwindPlan {
329339
} expr;
330340
// For m_type == isRaSearch
331341
int32_t ra_search_offset;
342+
// For m_type = isConstant
343+
uint64_t constant;
332344
} m_value;
333345
}; // class FAValue
334346

lldb/source/Symbol/UnwindPlan.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ operator==(const UnwindPlan::Row::FAValue &rhs) const {
187187
return !memcmp(m_value.expr.opcodes, rhs.m_value.expr.opcodes,
188188
m_value.expr.length);
189189
break;
190+
case isConstant:
191+
return m_value.constant == rhs.m_value.constant;
190192
}
191193
}
192194
return false;
@@ -214,6 +216,8 @@ void UnwindPlan::Row::FAValue::Dump(Stream &s, const UnwindPlan *unwind_plan,
214216
case isRaSearch:
215217
s.Printf("RaSearch@SP%+d", m_value.ra_search_offset);
216218
break;
219+
case isConstant:
220+
s.Printf("0x%" PRIx64, m_value.constant);
217221
}
218222
}
219223

lldb/source/Target/RegisterContextUnwind.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,6 +2088,12 @@ bool RegisterContextUnwind::ReadFrameAddress(
20882088
UnwindLogMsg("No suitable CFA found");
20892089
break;
20902090
}
2091+
case UnwindPlan::Row::FAValue::isConstant: {
2092+
address = fa.GetConstant();
2093+
address = m_thread.GetProcess()->FixDataAddress(address);
2094+
UnwindLogMsg("CFA value set by constant is 0x%" PRIx64, address);
2095+
return true;
2096+
}
20912097
default:
20922098
return false;
20932099
}

0 commit comments

Comments
 (0)