@@ -57,11 +57,24 @@ void ObjCActivity::AdjustCallType(Ref<AnalysisContext> ctx)
5757 if (insn.operation != LLIL_CALL_SSA)
5858 return ;
5959
60- // Filter out calls that aren't to `objc_msgSend`.
60+ enum class MessageSendType {
61+ Normal,
62+ Super,
63+ };
64+
65+ MessageSendType messageSendType = MessageSendType::Normal;
66+ // Filter out calls that aren't to `objc_msgSend`, `objc_msgSendSuper`, or `objc_msgSendSuper2`.
6167 auto callExpr = insn.GetDestExpr <LLIL_CALL_SSA>();
6268 if (auto symbol = bv->GetSymbolByAddress (callExpr.GetValue ().value ))
63- if (symbol->GetRawName () != " _objc_msgSend" )
64- return ;
69+ {
70+ std::string_view symbolName = symbol->GetRawNameRef ();
71+ if (symbolName == " _objc_msgSend" )
72+ messageSendType = MessageSendType::Normal;
73+ else if (symbolName == " _objc_msgSendSuper2" || symbolName == " _objc_msgSendSuper" )
74+ messageSendType = MessageSendType::Super;
75+ else
76+ return ;
77+ }
6578
6679 const auto params = insn.GetParameterExprs <LLIL_CALL_SSA>();
6780 // The second parameter passed to the objc_msgSend call is the address of
@@ -98,7 +111,15 @@ void ObjCActivity::AdjustCallType(Ref<AnalysisContext> ctx)
98111 std::vector<FunctionParameter> callTypeParams;
99112 auto cc = bv->GetDefaultPlatform ()->GetDefaultCallingConvention ();
100113
101- callTypeParams.emplace_back (" self" , retType, true , Variable ());
114+ if (messageSendType == MessageSendType::Normal)
115+ callTypeParams.emplace_back (" self" , retType, true , Variable ());
116+ else
117+ {
118+ auto superType = bv->GetTypeByName ({ " objc_super" });
119+ if (!superType)
120+ superType = Type::PointerType (ssa->GetArchitecture (), Type::VoidType ());
121+ callTypeParams.emplace_back (" super" , Type::PointerType (ssa->GetArchitecture (), superType), true , Variable ());
122+ }
102123
103124 auto selType = bv->GetTypeByName ({ " SEL" });
104125 if (!selType)
0 commit comments