\hypertarget { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t} { } \doxysection { theo\+ ::recomp\+ ::recomp\+ \_ \+ t Class Reference}
\label { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t} \index { theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} }
the main class responsible for recomposition
{ \ttfamily \# include \char `\" { } recomp.\+ hpp\char `\" { } }
\doxysubsection * { Public Member Functions}
\begin { DoxyCompactItemize}
\item
\mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ ac5f04297153c2e445330e5cc103e8589} { recomp\+ \_ \+ t} } (\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1decomp_ _ t} { decomp\+ ::decomp\+ \_ \+ t} } $ \ast $ dcmp, \mbox { \hyperlink { namespacetheo_ 1_ 1recomp_ a96995cb0c5291dce945760c3d8f55241} { allocator\+ \_ \+ t} } alloc, \mbox { \hyperlink { namespacetheo_ 1_ 1recomp_ a604e81450773453df676c3b573651adc} { copier\+ \_ \+ t} } copy, \mbox { \hyperlink { namespacetheo_ 1_ 1recomp_ a7364f8c94855a2a871a9d6e1057989f3} { resolver\+ \_ \+ t} } \mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a299fbede378f04991df2e39293307094} { resolve} } )
\begin { DoxyCompactList} \small \item \em the explicit constructor for the \mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t} { recomp\+ \_ \+ t} } class. \end { DoxyCompactList} \item
void \mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a78502665e218d3addca9b1e5e3875f39} { allocate} } ()
\begin { DoxyCompactList} \small \item \em when called, this function allocates space for every symbol. \end { DoxyCompactList} \item
void \mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a299fbede378f04991df2e39293307094} { resolve} } ()
\begin { DoxyCompactList} \small \item \em when called, this function resolves all relocations in every symbol. \end { DoxyCompactList} \item
void \mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a080d88f122d12faf2e328c9bdd10be6e} { copy\+ \_ \+ syms} } ()
\begin { DoxyCompactList} \small \item \em when called, this function copies symbols into allocations. \end { DoxyCompactList} \item
void \mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a0da9a904b0057c14190218592aff0f07} { allocator} } (\mbox { \hyperlink { namespacetheo_ 1_ 1recomp_ a96995cb0c5291dce945760c3d8f55241} { allocator\+ \_ \+ t} } alloc)
\begin { DoxyCompactList} \small \item \em setter for the allocater lambda function. \end { DoxyCompactList} \item
void \mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ aa6fecf752d4c5bc211e164d8496724b1} { copier} } (\mbox { \hyperlink { namespacetheo_ 1_ 1recomp_ a604e81450773453df676c3b573651adc} { copier\+ \_ \+ t} } copy)
\begin { DoxyCompactList} \small \item \em setter for the copier lambda function. \end { DoxyCompactList} \item
void \mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a1be6d0cdb57565c31b138248c8b2d470} { resolver} } (\mbox { \hyperlink { namespacetheo_ 1_ 1recomp_ a7364f8c94855a2a871a9d6e1057989f3} { resolver\+ \_ \+ t} } \mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a299fbede378f04991df2e39293307094} { resolve} } )
\begin { DoxyCompactList} \small \item \em setter for the resolve lambda function. \end { DoxyCompactList} \item
std\+ ::uintptr\+ \_ \+ t \mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ ae0c56f0f8af33b390e4123509523602c} { resolve} } (const std\+ ::string \& \& sym)
\begin { DoxyCompactList} \small \item \em resolves the address of a function given its name. \end { DoxyCompactList} \end { DoxyCompactItemize}
\doxysubsection { Detailed Description}
the main class responsible for recomposition
Definition at line \mbox { \hyperlink { recomp_ 8hpp_ source_ l00064} { 64} } of file \mbox { \hyperlink { recomp_ 8hpp_ source} { recomp.\+ hpp} } .
\doxysubsection { Constructor \& Destructor Documentation}
\mbox { \Hypertarget { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ ac5f04297153c2e445330e5cc103e8589} \label { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ ac5f04297153c2e445330e5cc103e8589} }
\index { theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} !recomp\_ t@{ recomp\_ t} }
\index { recomp\_ t@{ recomp\_ t} !theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} }
\doxysubsubsection { \texorpdfstring { recomp\_ t()} { recomp\_ t()} }
{ \footnotesize \ttfamily theo\+ ::recomp\+ ::recomp\+ \_ \+ t\+ ::recomp\+ \_ \+ t (\begin { DoxyParamCaption} \item [{\mbox{\hyperlink{classtheo_1_1decomp_1_1decomp__t}{decomp\+::decomp\+\_\+t}} $\ast$}] { dcmp, } \item [{\mbox{\hyperlink{namespacetheo_1_1recomp_a96995cb0c5291dce945760c3d8f55241}{allocator\+\_\+t}}}] { alloc, } \item [{\mbox{\hyperlink{namespacetheo_1_1recomp_a604e81450773453df676c3b573651adc}{copier\+\_\+t}}}] { copy, } \item [{\mbox{\hyperlink{namespacetheo_1_1recomp_a7364f8c94855a2a871a9d6e1057989f3}{resolver\+\_\+t}}}] { resolve } \end { DoxyParamCaption} )\hspace { 0.3cm} { \ttfamily [explicit]} }
the explicit constructor for the \mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t} { recomp\+ \_ \+ t} } class.
\begin { DoxyParams} { Parameters}
{ \em dcmp} & pointer to a decomp\+ \_ \+ t class.\\
\hline
{ \em alloc} & lambda function which is used to allocate memory for symbols.\\
\hline
{ \em copy} & lambda function used to copy bytes into allocations.\\
\hline
{ \em resolve} & lambda function used to resolve external symbols.\\
\hline
\end { DoxyParams}
Definition at line \mbox { \hyperlink { recomp_ 8cpp_ source_ l00034} { 34} } of file \mbox { \hyperlink { recomp_ 8cpp_ source} { recomp.\+ cpp} } .
\begin { DoxyCode} { 0}
\DoxyCodeLine { 00038 : m\_ dcmp(dcmp), m\_ allocator(alloc), m\_ copier(copy), m\_ resolver(\mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a299fbede378f04991df2e39293307094} { resolve} } ) \{ \} }
\end { DoxyCode}
\doxysubsection { Member Function Documentation}
\mbox { \Hypertarget { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a78502665e218d3addca9b1e5e3875f39} \label { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a78502665e218d3addca9b1e5e3875f39} }
\index { theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} !allocate@{ allocate} }
\index { allocate@{ allocate} !theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} }
\doxysubsubsection { \texorpdfstring { allocate()} { allocate()} }
{ \footnotesize \ttfamily void theo\+ ::recomp\+ ::recomp\+ \_ \+ t\+ ::allocate (\begin { DoxyParamCaption} { } \end { DoxyParamCaption} )}
when called, this function allocates space for every symbol.
Definition at line \mbox { \hyperlink { recomp_ 8cpp_ source_ l00040} { 40} } of file \mbox { \hyperlink { recomp_ 8cpp_ source} { recomp.\+ cpp} } .
\begin { DoxyCode} { 0}
\DoxyCodeLine { 00040 \{ }
\DoxyCodeLine { 00041 \textcolor { comment} { // map code \& data/rdata/bss sections first...} }
\DoxyCodeLine { 00042 \textcolor { comment} { //} }
\DoxyCodeLine { 00043 m\_ dcmp-\/ >\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1decomp_ _ t_ a8630f2ee0f4fb9516f5b20014e4c6120} { syms} } ()-\/ >\mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1symbol_ _ table_ _ t_ a35008ba37814a94209cf979302e13e6d} { for\_ each} } ([\& ](\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t} { theo::decomp::symbol\_ t} } \& sym) \{ }
\DoxyCodeLine { 00044 \textcolor { keywordflow} { switch} (sym.\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ a16587cddd37cd45d9ec6cd25c229e8d1} { type} } ()) \{ }
\DoxyCodeLine { 00045 case decomp::sym\_ type\_ t::section:}
\DoxyCodeLine { 00046 case decomp::sym\_ type\_ t::function:}
\DoxyCodeLine { 00047 case decomp::sym\_ type\_ t::instruction: \{ }
\DoxyCodeLine { 00048 sym.allocated\_ at(m\_ allocator(sym.size(), sym.scn()-\/ >characteristics));}
\DoxyCodeLine { 00049 break;}
\DoxyCodeLine { 00050 \} }
\DoxyCodeLine { 00051 \textcolor { keywordflow} { default} :}
\DoxyCodeLine { 00052 \textcolor { keywordflow} { break} ;}
\DoxyCodeLine { 00053 \} }
\DoxyCodeLine { 00054 \} );}
\DoxyCodeLine { 00055 }
\DoxyCodeLine { 00056 \textcolor { comment} { // then map data/rdata/bss symbols to the allocated sections...} }
\DoxyCodeLine { 00057 \textcolor { comment} { //} }
\DoxyCodeLine { 00058 m\_ dcmp-\/ >\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1decomp_ _ t_ a8630f2ee0f4fb9516f5b20014e4c6120} { syms} } ()-\/ >\mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1symbol_ _ table_ _ t_ a35008ba37814a94209cf979302e13e6d} { for\_ each} } ([\& ](\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t} { theo::decomp::symbol\_ t} } \& sym) \{ }
\DoxyCodeLine { 00059 \textcolor { keywordflow} { if} (sym.\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ a16587cddd37cd45d9ec6cd25c229e8d1} { type} } () == \mbox { \hyperlink { namespacetheo_ 1_ 1decomp_ af96177687d0ad683c5897d8fa01135f9acdb885c0ea7f6b2874224487c69b8112} { decomp::sym\_ type\_ t::data} } ) \{ }
\DoxyCodeLine { 00060 \textcolor { comment} { // if the symbol has a section then we will refer to the allocation made} }
\DoxyCodeLine { 00061 \textcolor { comment} { // for that section...} }
\DoxyCodeLine { 00062 \textcolor { comment} { //} }
\DoxyCodeLine { 00063 if (sym.scn()) \{ }
\DoxyCodeLine { 00064 auto scn\_ sym =}
\DoxyCodeLine { 00065 m\_ dcmp-\/ >syms()-\/ >sym\_ from\_ hash(m\_ dcmp-\/ >scn\_ hash\_ tbl()[sym.scn()]);}
\DoxyCodeLine { 00066 }
\DoxyCodeLine { 00067 if (!scn\_ sym.has\_ value()) \{ }
\DoxyCodeLine { 00068 spdlog::error(\textcolor { stringliteral} { "{ } failed to locate section: \{ \} for symbol: \{ \} "{ } } ,}
\DoxyCodeLine { 00069 sym.scn()-\/ >name.to\_ string(), sym.name());}
\DoxyCodeLine { 00070 }
\DoxyCodeLine { 00071 assert(scn\_ sym.has\_ value());}
\DoxyCodeLine { 00072 \} }
\DoxyCodeLine { 00073 }
\DoxyCodeLine { 00074 sym.allocated\_ at(scn\_ sym.value()-\/ >allocated\_ at() + sym.offset());}
\DoxyCodeLine { 00075 \} \textcolor { keywordflow} { else} \{ \textcolor { comment} { // else if there is no section then we allocate based upon the} }
\DoxyCodeLine { 00076 \textcolor { comment} { // size of the symbol... this is only done for symbols that are} }
\DoxyCodeLine { 00077 \textcolor { comment} { // bss...} }
\DoxyCodeLine { 00078 \textcolor { comment} { //} }
\DoxyCodeLine { 00079 }
\DoxyCodeLine { 00080 \textcolor { comment} { // bss is read write...} }
\DoxyCodeLine { 00081 \textcolor { comment} { //} }
\DoxyCodeLine { 00082 coff::section\_ characteristics\_ t prot = \{ \} ;}
\DoxyCodeLine { 00083 prot.mem\_ read = \textcolor { keyword} { true} ;}
\DoxyCodeLine { 00084 prot.mem\_ write = \textcolor { keyword} { true} ;}
\DoxyCodeLine { 00085 }
\DoxyCodeLine { 00086 sym.\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ ae92f3e35fba82a1d16a58ad09b39fb47} { allocated\_ at} } (m\_ allocator(sym.\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ ae33f1452b01fe80f9c384241b9fe6286} { size} } (), sym.\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ a64d51dabe91687ed40c3942d106fd7dd} { scn} } ()-\/ >characteristics));}
\DoxyCodeLine { 00087 \} }
\DoxyCodeLine { 00088 \} }
\DoxyCodeLine { 00089 \} );}
\DoxyCodeLine { 00090 \} }
\end { DoxyCode}
References \mbox { \hyperlink { symbol_ _ table_ 8cpp_ source_ l00049} { theo\+ ::recomp\+ ::symbol\+ \_ \+ table\+ \_ \+ t\+ ::for\+ \_ \+ each()} } , \mbox { \hyperlink { decomp_ 8cpp_ source_ l00293} { theo\+ ::decomp\+ ::decomp\+ \_ \+ t\+ ::syms()} } , and \mbox { \hyperlink { symbol_ 8cpp_ source_ l00080} { theo\+ ::decomp\+ ::symbol\+ \_ \+ t\+ ::type()} } .
Referenced by \mbox { \hyperlink { theo_ 8cpp_ source_ l00056} { theo\+ ::theo\+ \_ \+ t\+ ::compose()} } .
\mbox { \Hypertarget { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a0da9a904b0057c14190218592aff0f07} \label { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a0da9a904b0057c14190218592aff0f07} }
\index { theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} !allocator@{ allocator} }
\index { allocator@{ allocator} !theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} }
\doxysubsubsection { \texorpdfstring { allocator()} { allocator()} }
{ \footnotesize \ttfamily void theo\+ ::recomp\+ ::recomp\+ \_ \+ t\+ ::allocator (\begin { DoxyParamCaption} \item [{\mbox{\hyperlink{namespacetheo_1_1recomp_a96995cb0c5291dce945760c3d8f55241}{allocator\+\_\+t}}}] { alloc } \end { DoxyParamCaption} )}
setter for the allocater lambda function.
\begin { DoxyParams} { Parameters}
{ \em alloc} & lambda function which allocates memory for symbols.\\
\hline
\end { DoxyParams}
Definition at line \mbox { \hyperlink { recomp_ 8cpp_ source_ l00163} { 163} } of file \mbox { \hyperlink { recomp_ 8cpp_ source} { recomp.\+ cpp} } .
\begin { DoxyCode} { 0}
\DoxyCodeLine { 00163 \{ }
\DoxyCodeLine { 00164 m\_ allocator = alloc;}
\DoxyCodeLine { 00165 \} }
\end { DoxyCode}
\mbox { \Hypertarget { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ aa6fecf752d4c5bc211e164d8496724b1} \label { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ aa6fecf752d4c5bc211e164d8496724b1} }
\index { theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} !copier@{ copier} }
\index { copier@{ copier} !theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} }
\doxysubsubsection { \texorpdfstring { copier()} { copier()} }
{ \footnotesize \ttfamily void theo\+ ::recomp\+ ::recomp\+ \_ \+ t\+ ::copier (\begin { DoxyParamCaption} \item [{\mbox{\hyperlink{namespacetheo_1_1recomp_a604e81450773453df676c3b573651adc}{copier\+\_\+t}}}] { copy } \end { DoxyParamCaption} )}
setter for the copier lambda function.
\begin { DoxyParams} { Parameters}
{ \em copy} & copier lambda function used to copy bytes into allocations made by the allocator.\\
\hline
\end { DoxyParams}
Definition at line \mbox { \hyperlink { recomp_ 8cpp_ source_ l00167} { 167} } of file \mbox { \hyperlink { recomp_ 8cpp_ source} { recomp.\+ cpp} } .
\begin { DoxyCode} { 0}
\DoxyCodeLine { 00167 \{ }
\DoxyCodeLine { 00168 m\_ copier = copy;}
\DoxyCodeLine { 00169 \} }
\end { DoxyCode}
\mbox { \Hypertarget { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a080d88f122d12faf2e328c9bdd10be6e} \label { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a080d88f122d12faf2e328c9bdd10be6e} }
\index { theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} !copy\_ syms@{ copy\_ syms} }
\index { copy\_ syms@{ copy\_ syms} !theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} }
\doxysubsubsection { \texorpdfstring { copy\_ syms()} { copy\_ syms()} }
{ \footnotesize \ttfamily void theo\+ ::recomp\+ ::recomp\+ \_ \+ t\+ ::copy\+ \_ \+ syms (\begin { DoxyParamCaption} { } \end { DoxyParamCaption} )}
when called, this function copies symbols into allocations.
Definition at line \mbox { \hyperlink { recomp_ 8cpp_ source_ l00155} { 155} } of file \mbox { \hyperlink { recomp_ 8cpp_ source} { recomp.\+ cpp} } .
\begin { DoxyCode} { 0}
\DoxyCodeLine { 00155 \{ }
\DoxyCodeLine { 00156 \textcolor { comment} { // copy symbols into memory using the copier supplied...} }
\DoxyCodeLine { 00157 \textcolor { comment} { //} }
\DoxyCodeLine { 00158 m\_ dcmp-\/ >\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1decomp_ _ t_ a8630f2ee0f4fb9516f5b20014e4c6120} { syms} } ()-\/ >\mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1symbol_ _ table_ _ t_ a35008ba37814a94209cf979302e13e6d} { for\_ each} } ([\& ](\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t} { theo::decomp::symbol\_ t} } \& sym) \{ }
\DoxyCodeLine { 00159 m\_ copier(sym.\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ ae92f3e35fba82a1d16a58ad09b39fb47} { allocated\_ at} } (), sym.\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ aa3ecf0b480d10bffe68812409c06d61b} { data} } ().data(), sym.\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ aa3ecf0b480d10bffe68812409c06d61b} { data} } ().size());}
\DoxyCodeLine { 00160 \} );}
\DoxyCodeLine { 00161 \} }
\end { DoxyCode}
References \mbox { \hyperlink { symbol_ 8cpp_ source_ l00060} { theo\+ ::decomp\+ ::symbol\+ \_ \+ t\+ ::allocated\+ \_ \+ at()} } , and \mbox { \hyperlink { symbol_ 8cpp_ source_ l00076} { theo\+ ::decomp\+ ::symbol\+ \_ \+ t\+ ::data()} } .
Referenced by \mbox { \hyperlink { theo_ 8cpp_ source_ l00056} { theo\+ ::theo\+ \_ \+ t\+ ::compose()} } .
\mbox { \Hypertarget { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a299fbede378f04991df2e39293307094} \label { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a299fbede378f04991df2e39293307094} }
\index { theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} !resolve@{ resolve} }
\index { resolve@{ resolve} !theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} }
\doxysubsubsection { \texorpdfstring { resolve()} { resolve()} \hspace { 0.1cm} { \footnotesize \ttfamily [1/2]} }
{ \footnotesize \ttfamily void theo\+ ::recomp\+ ::recomp\+ \_ \+ t\+ ::resolve (\begin { DoxyParamCaption} { } \end { DoxyParamCaption} )}
when called, this function resolves all relocations in every symbol.
Definition at line \mbox { \hyperlink { recomp_ 8cpp_ source_ l00092} { 92} } of file \mbox { \hyperlink { recomp_ 8cpp_ source} { recomp.\+ cpp} } .
\begin { DoxyCode} { 0}
\DoxyCodeLine { 00092 \{ }
\DoxyCodeLine { 00093 \textcolor { comment} { // resolve relocations in all symbols...} }
\DoxyCodeLine { 00094 \textcolor { comment} { //} }
\DoxyCodeLine { 00095 m\_ dcmp-\/ >\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1decomp_ _ t_ a8630f2ee0f4fb9516f5b20014e4c6120} { syms} } ()-\/ >\mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1symbol_ _ table_ _ t_ a35008ba37814a94209cf979302e13e6d} { for\_ each} } ([\& ](\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t} { theo::decomp::symbol\_ t} } \& sym) \{ }
\DoxyCodeLine { 00096 \textcolor { keyword} { auto} \& relocs = sym.\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ abc158e1dc1567161f0a57ed15fc718f7} { relocs} } ();}
\DoxyCodeLine { 00097 std::for\_ each(relocs.begin(), relocs.end(), [\& ](reloc\_ t\& reloc) \{ }
\DoxyCodeLine { 00098 if (reloc.offset() > sym.data().size()) \{ }
\DoxyCodeLine { 00099 spdlog::error(}
\DoxyCodeLine { 00100 \textcolor { stringliteral} { "{ } invalid relocation... writing outside of symbol length... offset: "{ } } }
\DoxyCodeLine { 00101 \textcolor { stringliteral} { "{ } \{ \} sym size: \{ \} "{ } } ,}
\DoxyCodeLine { 00102 sym.offset(), sym.data().size());}
\DoxyCodeLine { 00103 }
\DoxyCodeLine { 00104 assert(reloc.offset() > sym.data().size());}
\DoxyCodeLine { 00105 \} }
\DoxyCodeLine { 00106 }
\DoxyCodeLine { 00107 \textcolor { comment} { // try and resolve the symbol by refering to the internal symbol table} }
\DoxyCodeLine { 00108 \textcolor { comment} { // first... if there is no symbol then refer to the resolver...} }
\DoxyCodeLine { 00109 \textcolor { comment} { //} }
\DoxyCodeLine { 00110 \textcolor { keyword} { auto} reloc\_ sym = m\_ dcmp-\/ >\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1decomp_ _ t_ a8630f2ee0f4fb9516f5b20014e4c6120} { syms} } ()-\/ >\mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1symbol_ _ table_ _ t_ a308c0dbcc4d569467e0986b32ef30db5} { sym\_ from\_ hash} } (reloc.hash());}
\DoxyCodeLine { 00111 \textcolor { keyword} { auto} allocated\_ at = reloc\_ sym.has\_ value()}
\DoxyCodeLine { 00112 ? reloc\_ sym.value()-\/ >allocated\_ at()}
\DoxyCodeLine { 00113 : m\_ resolver(reloc.name());}
\DoxyCodeLine { 00114 }
\DoxyCodeLine { 00115 if (!allocated\_ at) \{ }
\DoxyCodeLine { 00116 spdlog::error(\textcolor { stringliteral} { "{ } failed to resolve reloc from symbol: \{ \} to symbol: \{ \} "{ } } ,}
\DoxyCodeLine { 00117 sym.\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ a7c6dee036291ded334aa10d89293fc2a} { name} } (), reloc.name());}
\DoxyCodeLine { 00118 }
\DoxyCodeLine { 00119 assert(allocated\_ at);}
\DoxyCodeLine { 00120 \} }
\DoxyCodeLine { 00121 }
\DoxyCodeLine { 00122 \textcolor { keywordflow} { switch} (sym.\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ a16587cddd37cd45d9ec6cd25c229e8d1} { type} } ()) \{ }
\DoxyCodeLine { 00123 \textcolor { keywordflow} { case} \mbox { \hyperlink { namespacetheo_ 1_ 1decomp_ af96177687d0ad683c5897d8fa01135f9a46b3b57c5d47e2818b2ea10b96b43cd6} { decomp::sym\_ type\_ t::section} } : \{ }
\DoxyCodeLine { 00124 \textcolor { keyword} { auto} scn\_ sym =}
\DoxyCodeLine { 00125 m\_ dcmp-\/ >\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1decomp_ _ t_ a8630f2ee0f4fb9516f5b20014e4c6120} { syms} } ()-\/ >\mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1symbol_ _ table_ _ t_ a308c0dbcc4d569467e0986b32ef30db5} { sym\_ from\_ hash} } (m\_ dcmp-\/ >\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1decomp_ _ t_ a860dddc3a5d12231b685dbaa12a0db06} { scn\_ hash\_ tbl} } ()[sym.\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ a64d51dabe91687ed40c3942d106fd7dd} { scn} } ()]);}
\DoxyCodeLine { 00126 }
\DoxyCodeLine { 00127 *\textcolor { keyword} { reinterpret\_ cast<} std::uintptr\_ t*\textcolor { keyword} { >} (scn\_ sym.value()-\/ >data().data() +}
\DoxyCodeLine { 00128 reloc.offset()) = allocated\_ at;}
\DoxyCodeLine { 00129 \textcolor { keywordflow} { break} ;}
\DoxyCodeLine { 00130 \} }
\DoxyCodeLine { 00131 \textcolor { keywordflow} { case} \mbox { \hyperlink { namespacetheo_ 1_ 1decomp_ af96177687d0ad683c5897d8fa01135f9acf6baee49c2ddb7e89724231bbd75d4a} { decomp::sym\_ type\_ t::function} } : \{ }
\DoxyCodeLine { 00132 *\textcolor { keyword} { reinterpret\_ cast<} std::uintptr\_ t*\textcolor { keyword} { >} (sym.\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ aa3ecf0b480d10bffe68812409c06d61b} { data} } ().data() +}
\DoxyCodeLine { 00133 reloc.offset()) = allocated\_ at;}
\DoxyCodeLine { 00134 \textcolor { keywordflow} { break} ;}
\DoxyCodeLine { 00135 \} }
\DoxyCodeLine { 00136 \textcolor { keywordflow} { case} \mbox { \hyperlink { namespacetheo_ 1_ 1decomp_ af96177687d0ad683c5897d8fa01135f9a4842f4c175b1ec87fc82ef3757d3a0e9} { decomp::sym\_ type\_ t::instruction} } : \{ }
\DoxyCodeLine { 00137 \textcolor { keyword} { auto} \& transforms = reloc.get\_ transforms();}
\DoxyCodeLine { 00138 std::for\_ each(}
\DoxyCodeLine { 00139 transforms.begin(), transforms.end(),}
\DoxyCodeLine { 00140 [\& ](std::pair<obf::transform::transform\_ t*, std::uint32\_ t>\& t) \{ }
\DoxyCodeLine { 00141 allocated\_ at = (*t.first)(allocated\_ at, t.second);}
\DoxyCodeLine { 00142 \} );}
\DoxyCodeLine { 00143 }
\DoxyCodeLine { 00144 *\textcolor { keyword} { reinterpret\_ cast<} std::uintptr\_ t*\textcolor { keyword} { >} (sym.\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ aa3ecf0b480d10bffe68812409c06d61b} { data} } ().data() +}
\DoxyCodeLine { 00145 reloc.offset()) = allocated\_ at;}
\DoxyCodeLine { 00146 \textcolor { keywordflow} { break} ;}
\DoxyCodeLine { 00147 \} }
\DoxyCodeLine { 00148 \textcolor { keywordflow} { default} :}
\DoxyCodeLine { 00149 \textcolor { keywordflow} { break} ;}
\DoxyCodeLine { 00150 \} }
\DoxyCodeLine { 00151 \} );}
\DoxyCodeLine { 00152 \} );}
\DoxyCodeLine { 00153 \} }
\end { DoxyCode}
References \mbox { \hyperlink { symbol_ 8cpp_ source_ l00076} { theo\+ ::decomp\+ ::symbol\+ \_ \+ t\+ ::data()} } , \mbox { \hyperlink { symbol_ 8hpp_ source_ l00044} { theo\+ ::decomp\+ ::function} } , \mbox { \hyperlink { reloc_ 8hpp_ source_ l00101} { theo\+ ::recomp\+ ::reloc\+ \_ \+ t\+ ::get\+ \_ \+ transforms()} } , \mbox { \hyperlink { reloc_ 8hpp_ source_ l00061} { theo\+ ::recomp\+ ::reloc\+ \_ \+ t\+ ::hash()} } , \mbox { \hyperlink { symbol_ 8hpp_ source_ l00045} { theo\+ ::decomp\+ ::instruction} } , \mbox { \hyperlink { reloc_ 8hpp_ source_ l00067} { theo\+ ::recomp\+ ::reloc\+ \_ \+ t\+ ::name()} } , \mbox { \hyperlink { symbol_ 8cpp_ source_ l00052} { theo\+ ::decomp\+ ::symbol\+ \_ \+ t\+ ::name()} } , \mbox { \hyperlink { reloc_ 8hpp_ source_ l00075} { theo\+ ::recomp\+ ::reloc\+ \_ \+ t\+ ::offset()} } , \mbox { \hyperlink { symbol_ 8cpp_ source_ l00096} { theo\+ ::decomp\+ ::symbol\+ \_ \+ t\+ ::relocs()} } , \mbox { \hyperlink { symbol_ 8cpp_ source_ l00064} { theo\+ ::decomp\+ ::symbol\+ \_ \+ t\+ ::scn()} } , \mbox { \hyperlink { symbol_ 8hpp_ source_ l00047} { theo\+ ::decomp\+ ::section} } , and \mbox { \hyperlink { symbol_ 8cpp_ source_ l00080} { theo\+ ::decomp\+ ::symbol\+ \_ \+ t\+ ::type()} } .
Referenced by \mbox { \hyperlink { theo_ 8cpp_ source_ l00056} { theo\+ ::theo\+ \_ \+ t\+ ::compose()} } .
\mbox { \Hypertarget { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ ae0c56f0f8af33b390e4123509523602c} \label { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ ae0c56f0f8af33b390e4123509523602c} }
\index { theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} !resolve@{ resolve} }
\index { resolve@{ resolve} !theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} }
\doxysubsubsection { \texorpdfstring { resolve()} { resolve()} \hspace { 0.1cm} { \footnotesize \ttfamily [2/2]} }
{ \footnotesize \ttfamily std\+ ::uintptr\+ \_ \+ t theo\+ ::recomp\+ ::recomp\+ \_ \+ t\+ ::resolve (\begin { DoxyParamCaption} \item [{const std\+::string \&\&}] { sym } \end { DoxyParamCaption} )}
resolves the address of a function given its name.
\begin { DoxyParams} { Parameters}
{ \em sym} & the name of the symbol to resolve the location of.\\
\hline
\end { DoxyParams}
\begin { DoxyReturn} { Returns}
the address of the symbol.
\end { DoxyReturn}
Definition at line \mbox { \hyperlink { recomp_ 8cpp_ source_ l00175} { 175} } of file \mbox { \hyperlink { recomp_ 8cpp_ source} { recomp.\+ cpp} } .
\begin { DoxyCode} { 0}
\DoxyCodeLine { 00175 \{ }
\DoxyCodeLine { 00176 \textcolor { keyword} { auto} res = m\_ dcmp-\/ >\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1decomp_ _ t_ a8630f2ee0f4fb9516f5b20014e4c6120} { syms} } ()-\/ >\mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1symbol_ _ table_ _ t_ a308c0dbcc4d569467e0986b32ef30db5} { sym\_ from\_ hash} } (\mbox { \hyperlink { classtheo_ 1_ 1decomp_ 1_ 1symbol_ _ t_ a8695d75670cc4d61d275464e9109ff06} { decomp::symbol\_ t::hash} } (sym));}
\DoxyCodeLine { 00177 \textcolor { keywordflow} { return} res.has\_ value() ? res.value()-\/ >allocated\_ at() : 0;}
\DoxyCodeLine { 00178 \} }
\end { DoxyCode}
References \mbox { \hyperlink { symbol_ 8cpp_ source_ l00088} { theo\+ ::decomp\+ ::symbol\+ \_ \+ t\+ ::hash()} } .
\mbox { \Hypertarget { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a1be6d0cdb57565c31b138248c8b2d470} \label { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a1be6d0cdb57565c31b138248c8b2d470} }
\index { theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} !resolver@{ resolver} }
\index { resolver@{ resolver} !theo::recomp::recomp\_ t@{ theo::recomp::recomp\_ t} }
\doxysubsubsection { \texorpdfstring { resolver()} { resolver()} }
{ \footnotesize \ttfamily void theo\+ ::recomp\+ ::recomp\+ \_ \+ t\+ ::resolver (\begin { DoxyParamCaption} \item [{\mbox{\hyperlink{namespacetheo_1_1recomp_a7364f8c94855a2a871a9d6e1057989f3}{resolver\+\_\+t}}}] { resolve } \end { DoxyParamCaption} )}
setter for the resolve lambda function.
\begin { DoxyParams} { Parameters}
{ \em resolve} & lambda function to resolve external symbols.\\
\hline
\end { DoxyParams}
Definition at line \mbox { \hyperlink { recomp_ 8cpp_ source_ l00171} { 171} } of file \mbox { \hyperlink { recomp_ 8cpp_ source} { recomp.\+ cpp} } .
\begin { DoxyCode} { 0}
\DoxyCodeLine { 00171 \{ }
\DoxyCodeLine { 00172 m\_ resolver = \mbox { \hyperlink { classtheo_ 1_ 1recomp_ 1_ 1recomp_ _ t_ a299fbede378f04991df2e39293307094} { resolve} } ;}
\DoxyCodeLine { 00173 \} }
\end { DoxyCode}
The documentation for this class was generated from the following files\+ :\begin { DoxyCompactItemize}
\item
include/recomp/\mbox { \hyperlink { recomp_ 8hpp} { recomp.\+ hpp} } \item
src/recomp/\mbox { \hyperlink { recomp_ 8cpp} { recomp.\+ cpp} } \end { DoxyCompactItemize}