\hypertarget{decomp_8hpp_source}{}\doxysection{decomp.\+hpp} \label{decomp_8hpp_source}\index{include/decomp/decomp.hpp@{include/decomp/decomp.hpp}} \mbox{\hyperlink{decomp_8hpp}{Go to the documentation of this file.}} \begin{DoxyCode}{0} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00001}00001 \textcolor{comment}{// Copyright (c) 2022, \_xeroxz}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00002}00002 \textcolor{comment}{// All rights reserved.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00003}00003 \textcolor{comment}{//}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00004}00004 \textcolor{comment}{// Redistribution and use in source and binary forms, with or without}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00005}00005 \textcolor{comment}{// modification, are permitted provided that the following conditions are met:}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00006}00006 \textcolor{comment}{//}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00007}00007 \textcolor{comment}{// 1. Redistributions of source code must retain the above copyright notice,}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00008}00008 \textcolor{comment}{// this list of conditions and the following disclaimer.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00009}00009 \textcolor{comment}{//}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00010}00010 \textcolor{comment}{// 2. Redistributions in binary form must reproduce the above copyright notice,}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00011}00011 \textcolor{comment}{// this list of conditions and the following disclaimer in the documentation}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00012}00012 \textcolor{comment}{// and/or other materials provided with the distribution.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00013}00013 \textcolor{comment}{//}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00014}00014 \textcolor{comment}{// 3. Neither the name of the copyright holder nor the names of its}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00015}00015 \textcolor{comment}{// contributors may be used to endorse or promote products derived from}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00016}00016 \textcolor{comment}{// this software without specific prior written permission.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00017}00017 \textcolor{comment}{//}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00018}00018 \textcolor{comment}{// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "{}AS IS"{}}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00019}00019 \textcolor{comment}{// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00020}00020 \textcolor{comment}{// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00021}00021 \textcolor{comment}{// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00022}00022 \textcolor{comment}{// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00023}00023 \textcolor{comment}{// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00024}00024 \textcolor{comment}{// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00025}00025 \textcolor{comment}{// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00026}00026 \textcolor{comment}{// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00027}00027 \textcolor{comment}{// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00028}00028 \textcolor{comment}{// POSSIBILITY OF SUCH DAMAGE.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00029}00029 \textcolor{comment}{//}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00030}00030 } \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00031}00031 \textcolor{preprocessor}{\#pragma once}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00032}00032 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00033}00033 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00034}00034 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00035}00035 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00036}00036 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00037}00037 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00038}00038 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00039}00039 } \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00040}00040 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{routine_8hpp}{decomp/routine.hpp}}>}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00041}00041 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{symbol__table_8hpp}{recomp/symbol\_table.hpp}}>}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00042}00042 } \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00043}00043 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00044}00044 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00045}00045 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00046}00046 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00047}00047 \textcolor{comment}{/// the namespace that contains all of the decomposition related code.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00048}00048 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00049}\mbox{\hyperlink{namespacetheo}{00049}} \textcolor{comment}{}\textcolor{keyword}{namespace }\mbox{\hyperlink{namespacetheo_1_1decomp}{theo::decomp}} \{} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00050}00050 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00051}00051 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00052}00052 \textcolor{comment}{/// meta symbol data. consists of the coff image which contains the coff symbol,}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00053}00053 \textcolor{comment}{/// the coff symbol itself, and the size (if any) of the symbol.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00054}00054 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00055}\mbox{\hyperlink{namespacetheo_1_1decomp_abbf09e1f7eb9e42057ff9c9e8be41266}{00055}} \textcolor{comment}{}\textcolor{keyword}{using} \mbox{\hyperlink{namespacetheo_1_1decomp_abbf09e1f7eb9e42057ff9c9e8be41266}{sym\_data\_t}} = std::tuple;} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00056}00056 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00057}00057 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00058}00058 \textcolor{comment}{/// the main decomposition class which is responsible for breaking down lib file}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00059}00059 \textcolor{comment}{/// into coff files, and extracted used symbols from the coff files.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00060}00060 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00061}\mbox{\hyperlink{classtheo_1_1decomp_1_1decomp__t}{00061}} \textcolor{comment}{}\textcolor{keyword}{class }\mbox{\hyperlink{classtheo_1_1decomp_1_1decomp__t}{decomp\_t}} \{} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00062}00062 \textcolor{keyword}{public}:\textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00063}00063 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00064}00064 \textcolor{comment}{ /// the explicit constructor for decomp\_t}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00065}00065 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00066}00066 \textcolor{comment}{ /// vector of bytes containing the lib file.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00067}00067 \textcolor{comment}{ /// symbol table that gets populated and managed by this}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00068}00068 \textcolor{comment}{ /// class.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00069}00069 \textcolor{comment}{} \textcolor{keyword}{explicit} \mbox{\hyperlink{classtheo_1_1decomp_1_1decomp__t_a35cfac16bd918d576b29e04388690d68}{decomp\_t}}(std::vector\& \mbox{\hyperlink{classtheo_1_1decomp_1_1decomp__t_aa728bde8ec1c5c28ec09f86adf427ae2}{lib}},} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00070}00070 \mbox{\hyperlink{classtheo_1_1recomp_1_1symbol__table__t}{recomp::symbol\_table\_t}}* \mbox{\hyperlink{classtheo_1_1decomp_1_1decomp__t_a8630f2ee0f4fb9516f5b20014e4c6120}{syms}});} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00071}00071 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00072}00072 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00073}00073 \textcolor{comment}{ /// gets all of the routine objects.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00074}00074 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00075}00075 \textcolor{comment}{ /// vector of routine objects.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00076}00076 \textcolor{comment}{} std::vector \mbox{\hyperlink{classtheo_1_1decomp_1_1decomp__t_a79c965ec0a996a936faae7f54b0e055e}{rtns}}();} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00077}00077 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00078}00078 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00079}00079 \textcolor{comment}{ /// gets a vector of bytes consisting of the lib file.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00080}00080 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00081}00081 \textcolor{comment}{ /// a vector of bytes consisting of the lib file.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00082}00082 \textcolor{comment}{} std::vector \mbox{\hyperlink{classtheo_1_1decomp_1_1decomp__t_aa728bde8ec1c5c28ec09f86adf427ae2}{lib}}();} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00083}00083 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00084}00084 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00085}00085 \textcolor{comment}{ /// gets all the obj files as a vector of a vector of bytes.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00086}00086 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00087}00087 \textcolor{comment}{ /// all the obj files as a vector of a vector of bytes.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00088}00088 \textcolor{comment}{} std::vector> \mbox{\hyperlink{classtheo_1_1decomp_1_1decomp__t_a81ae70b313a9ef24ea5d8f404699baef}{objs}}();} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00089}00089 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00090}00090 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00091}00091 \textcolor{comment}{ /// gets the symbol table.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00092}00092 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00093}00093 \textcolor{comment}{ /// the symbol table.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00094}00094 \textcolor{comment}{} \mbox{\hyperlink{classtheo_1_1recomp_1_1symbol__table__t}{recomp::symbol\_table\_t}}* \mbox{\hyperlink{classtheo_1_1decomp_1_1decomp__t_a8630f2ee0f4fb9516f5b20014e4c6120}{syms}}();} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00095}00095 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00096}00096 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00097}00097 \textcolor{comment}{ /// gets the section hash table section header -\/-\/> hash of the section header}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00098}00098 \textcolor{comment}{ /// ptr.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00099}00099 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00100}00100 \textcolor{comment}{ /// the section hash table section header -\/-\/> hash of the section}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00101}00101 \textcolor{comment}{ /// header ptr.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00102}00102 \textcolor{comment}{} std::map\& \mbox{\hyperlink{classtheo_1_1decomp_1_1decomp__t_a860dddc3a5d12231b685dbaa12a0db06}{scn\_hash\_tbl}}();} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00103}00103 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00104}00104 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00105}00105 \textcolor{comment}{ /// decomposes (extracts) the symbols used. this function determines all used}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00106}00106 \textcolor{comment}{ /// symbols given the entry point.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00107}00107 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00108}00108 \textcolor{comment}{ /// the entry point symbol name.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00109}00109 \textcolor{comment}{ /// returns an optional pointer to the symbol table. no value in the}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00110}00110 \textcolor{comment}{ /// optional object on failure.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00111}00111 \textcolor{comment}{} std::optional \mbox{\hyperlink{classtheo_1_1decomp_1_1decomp__t_ae23353a4293aa30969b6d3fa37359469}{decompose}}(std::string\& entry\_sym);} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00112}00112 } \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00113}00113 \textcolor{keyword}{private}:\textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00114}00114 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00115}00115 \textcolor{comment}{ /// extracts used symbols from coff files.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00116}00116 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00117}00117 \textcolor{comment}{ /// the entry point symbol name}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00118}00118 \textcolor{comment}{ /// number of symbols used}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00119}00119 \textcolor{comment}{} std::uint32\_t ext\_used\_syms(\textcolor{keyword}{const} std::string\&\& entry\_sym);} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00120}00120 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00121}00121 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00122}00122 \textcolor{comment}{ /// get symbol meta data by name.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00123}00123 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00124}00124 \textcolor{comment}{ /// symbol name}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00125}00125 \textcolor{comment}{ /// optional symbol meta data if it exists.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00126}00126 \textcolor{comment}{} std::optional get\_symbol(\textcolor{keyword}{const} std::string\_view\& name);} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00127}00127 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00128}00128 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00129}00129 \textcolor{comment}{ /// the next symbol in the section.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00130}00130 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00131}00131 \textcolor{comment}{ /// coff image that contains the symbol.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00132}00132 \textcolor{comment}{ /// coff section header of the section that contains the}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00133}00133 \textcolor{comment}{ /// symbol.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00134}00134 \textcolor{comment}{ /// symbol in which to get the next one of.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00135}00135 \textcolor{comment}{ /// offset into the section where the next symbol is at.}} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00136}00136 \textcolor{comment}{} std::uint32\_t next\_sym(coff::image\_t* img,} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00137}00137 coff::section\_header\_t* hdr,} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00138}00138 coff::symbol\_t* s);} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00139}00139 } \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00140}00140 \textcolor{keyword}{const} std::vector m\_lib;} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00141}00141 std::vector> m\_objs;} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00142}00142 std::vector m\_rtns;} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00143}00143 std::set m\_used\_syms;} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00144}00144 std::set m\_processed\_objs;} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00145}00145 std::map m\_scn\_hash\_tbl;} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00146}00146 std::map> m\_lookup\_tbl;} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00147}00147 \mbox{\hyperlink{classtheo_1_1recomp_1_1symbol__table__t}{recomp::symbol\_table\_t}}* m\_syms;} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00148}00148 \};} \DoxyCodeLine{\Hypertarget{decomp_8hpp_source_l00149}00149 \} \textcolor{comment}{// namespace theo::decomp}} \end{DoxyCode}