[Lldb-commits] [PATCH] D136209: [LLDB][NativePDB] Fix parameter size for member functions LF_MFUNCTION
Zequan Wu via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 18 16:09:37 PDT 2022
zequanwu created this revision.
zequanwu added reviewers: labath, rnk.
Herald added a project: All.
zequanwu requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Fix the problem that it was treating member functions as non-member functions
when trying to get the parameter size. This causes some non-parameter variables
showing up in function signature. Suprisingly,
`cantFail(TypeDeserializer::deserializeAs<ProcedureRecord>(...))` just sliently
parse it without error and gave the wrong result.
It's hard to test it. This only causes problem when `params_remaining`
is larger than the real parameter size. If it's smaller, we also check
individual local variable's attribute to see it's a parameter. When I trying to
come up with a test, the parameter size is always 0 if we parse LF_MFUNCTION as
LF_PROCEDURE.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D136209
Files:
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -1897,9 +1897,24 @@
ProcSym proc(static_cast<SymbolRecordKind>(sym.kind()));
cantFail(SymbolDeserializer::deserializeAs<ProcSym>(sym, proc));
CVType signature = m_index->tpi().getType(proc.FunctionType);
- ProcedureRecord sig;
- cantFail(TypeDeserializer::deserializeAs<ProcedureRecord>(signature, sig));
- params_remaining = sig.getParameterCount();
+ if (signature.kind() == LF_PROCEDURE) {
+ ProcedureRecord sig;
+ if (llvm::Error e = TypeDeserializer::deserializeAs<ProcedureRecord>(
+ signature, sig)) {
+ llvm::consumeError(std::move(e));
+ return 0;
+ }
+ params_remaining = sig.getParameterCount();
+ } else if (signature.kind() == LF_MFUNCTION) {
+ MemberFunctionRecord sig;
+ if (llvm::Error e = TypeDeserializer::deserializeAs<MemberFunctionRecord>(
+ signature, sig)) {
+ llvm::consumeError(std::move(e));
+ return 0;
+ }
+ params_remaining = sig.getParameterCount();
+ } else
+ return 0;
break;
}
case S_BLOCK32:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136209.468732.patch
Type: text/x-patch
Size: 1350 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221018/f1f9babb/attachment.bin>
More information about the lldb-commits
mailing list