move src directory to oi (#134)

This commit is contained in:
Jon Haslam 2023-04-26 16:20:53 +01:00 committed by GitHub
parent c0bfe87342
commit d4891e98d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 126 additions and 127 deletions

View File

@ -212,8 +212,6 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
include_directories(SYSTEM "${DRGN_PATH}") include_directories(SYSTEM "${DRGN_PATH}")
if (STATIC_LINK) if (STATIC_LINK)
# glog links against the `gflags` target, which is an alias for `gflags_shared` # glog links against the `gflags` target, which is an alias for `gflags_shared`
# For static builds, we force it to link against `gflags_static` instead # For static builds, we force it to link against `gflags_static` instead
@ -223,15 +221,15 @@ endif()
# FIXME: LLVM 12's source code is not compatible with C++20. # FIXME: LLVM 12's source code is not compatible with C++20.
# We should check with the compiler team if we could apply a fix to our LLVM. # We should check with the compiler team if we could apply a fix to our LLVM.
# In the meantime, we can compile OICompiler with C++17. # In the meantime, we can compile OICompiler with C++17.
set_source_files_properties(src/OICompiler.cpp PROPERTIES COMPILE_FLAGS -std=c++17 SKIP_PRECOMPILE_HEADERS ON) set_source_files_properties(oi/OICompiler.cpp PROPERTIES COMPILE_FLAGS -std=c++17 SKIP_PRECOMPILE_HEADERS ON)
## OI Dependencies (linked to by output libraries and executables) ## OI Dependencies (linked to by output libraries and executables)
### OI Language Parser ### OI Language Parser
BISON_TARGET(Parser src/OIParser.yy ${CMAKE_CURRENT_BINARY_DIR}/OIParser.tab.cpp BISON_TARGET(Parser oi/OIParser.yy ${CMAKE_CURRENT_BINARY_DIR}/OIParser.tab.cpp
DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/OIParser.tab.hh) DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/OIParser.tab.hh)
FLEX_TARGET(Lexer src/OILexer.l ${CMAKE_CURRENT_BINARY_DIR}/OILexer.cpp) FLEX_TARGET(Lexer oi/OILexer.l ${CMAKE_CURRENT_BINARY_DIR}/OILexer.cpp)
ADD_FLEX_BISON_DEPENDENCY(Lexer Parser) ADD_FLEX_BISON_DEPENDENCY(Lexer Parser)
@ -239,17 +237,17 @@ add_library(oid_parser STATIC ${BISON_Parser_OUTPUTS} ${FLEX_Lexer_OUTPUTS})
target_link_libraries(oid_parser glog::glog) target_link_libraries(oid_parser glog::glog)
### Core OI ### Core OI
add_subdirectory(src)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(oi)
add_library(oicore add_library(oicore
src/Descs.cpp oi/Descs.cpp
src/Metrics.cpp oi/Metrics.cpp
src/OICache.cpp oi/OICache.cpp
src/OICompiler.cpp oi/OICompiler.cpp
src/OIUtils.cpp oi/OIUtils.cpp
src/PaddingHunter.cpp oi/PaddingHunter.cpp
src/Serialize.cpp oi/Serialize.cpp
) )
add_dependencies(oicore libdrgn) add_dependencies(oicore libdrgn)
set_project_warnings(oicore) set_project_warnings(oicore)
@ -290,7 +288,7 @@ target_link_libraries(oicore
) )
### TreeBuilder ### TreeBuilder
add_library(treebuilder src/TreeBuilder.cpp) add_library(treebuilder oi/TreeBuilder.cpp)
add_dependencies(treebuilder librocksdb) add_dependencies(treebuilder librocksdb)
target_link_libraries(treebuilder target_link_libraries(treebuilder
${rocksdb_BINARY_DIR}/librocksdb.a ${rocksdb_BINARY_DIR}/librocksdb.a
@ -302,15 +300,16 @@ target_link_libraries(treebuilder
## OI Outputs ## OI Outputs
### Object Introspection as a Library (OIL) ### Object Introspection as a Library (OIL)
add_library(oil src/OILibrary.cpp src/OILibraryImpl.cpp) add_library(oil oi/OILibrary.cpp oi/OILibraryImpl.cpp)
target_include_directories(oil PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) target_include_directories(oil PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(oil oicore) target_link_libraries(oil oicore)
### Object Introspection as a Library Generator (OILGen) ### Object Introspection as a Library Generator (OILGen)
add_executable(oilgen add_executable(oilgen
tools/OILGen.cpp tools/OILGen.cpp
src/OIGenerator.cpp oi/OIGenerator.cpp
) )
target_link_libraries(oilgen target_link_libraries(oilgen
drgn_utils drgn_utils
oicore oicore
@ -327,7 +326,7 @@ set_project_warnings(oitb)
target_link_libraries(oitb oicore treebuilder) target_link_libraries(oitb oicore treebuilder)
### Object Introspection Debugger (OID) ### Object Introspection Debugger (OID)
add_executable(oid src/OID.cpp src/OIDebugger.cpp) add_executable(oid oi/OID.cpp oi/OIDebugger.cpp)
set_project_warnings(oid) set_project_warnings(oid)
target_link_libraries(oid oicore oid_parser treebuilder) target_link_libraries(oid oicore oid_parser treebuilder)

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "ContainerInfo.h" #include "oi/ContainerInfo.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <toml++/toml.h> #include <toml++/toml.h>

View File

@ -21,7 +21,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "Common.h" #include "oi/Common.h"
ContainerTypeEnum containerTypeEnumFromStr(std::string& str); ContainerTypeEnum containerTypeEnumFromStr(std::string& str);
const char* containerTypeEnumToStr(ContainerTypeEnum ty); const char* containerTypeEnumToStr(ContainerTypeEnum ty);

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "Descs.h" #include "oi/Descs.h"
#include <glog/logging.h> #include <glog/logging.h>

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include "DrgnUtils.h" #include "oi/DrgnUtils.h"
#include <glog/logging.h> #include <glog/logging.h>

View File

@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "FuncGen.h" #include "oi/FuncGen.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <map> #include <map>
#include "ContainerInfo.h" #include "oi/ContainerInfo.h"
namespace { namespace {

View File

@ -19,7 +19,7 @@
#include <set> #include <set>
#include <string> #include <string>
#include "ContainerInfo.h" #include "oi/ContainerInfo.h"
namespace fs = std::filesystem; namespace fs = std::filesystem;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "Metrics.h" #include "oi/Metrics.h"
#include <unistd.h> #include <unistd.h>

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "OICache.h" #include "oi/OICache.h"
#include <glog/logging.h> #include <glog/logging.h>
@ -21,9 +21,9 @@
#include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_oarchive.hpp>
#include <fstream> #include <fstream>
#include "Descs.h" #include "oi/Descs.h"
#include "OICodeGen.h" #include "oi/OICodeGen.h"
#include "Serialize.h" #include "oi/Serialize.h"
#ifndef OSS_ENABLE #ifndef OSS_ENABLE
#include "cea/object-introspection/internal/GobsService.h" #include "cea/object-introspection/internal/GobsService.h"

View File

@ -20,9 +20,9 @@
#include <memory> #include <memory>
#include <optional> #include <optional>
#include "OICodeGen.h" #include "oi/OICodeGen.h"
#include "OIParser.h" #include "oi/OIParser.h"
#include "SymbolService.h" #include "oi/SymbolService.h"
namespace fs = std::filesystem; namespace fs = std::filesystem;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "OICodeGen.h" #include "oi/OICodeGen.h"
#include <folly/SharedMutex.h> #include <folly/SharedMutex.h>
#include <glog/logging.h> #include <glog/logging.h>
@ -32,11 +32,11 @@
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include "DrgnUtils.h" #include "oi/DrgnUtils.h"
#include "FuncGen.h" #include "oi/FuncGen.h"
#include "OIParser.h" #include "oi/OIParser.h"
#include "PaddingHunter.h" #include "oi/PaddingHunter.h"
#include "SymbolService.h" #include "oi/SymbolService.h"
namespace fs = std::filesystem; namespace fs = std::filesystem;

View File

@ -26,11 +26,11 @@
class SymbolService; class SymbolService;
struct irequest; struct irequest;
#include "Common.h" #include "oi/Common.h"
#include "ContainerInfo.h" #include "oi/ContainerInfo.h"
#include "Features.h" #include "oi/Features.h"
#include "FuncGen.h" #include "oi/FuncGen.h"
#include "PaddingHunter.h" #include "oi/PaddingHunter.h"
extern "C" { extern "C" {
#include <drgn.h> #include <drgn.h>

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "OICompiler.h" #include "oi/OICompiler.h"
#include <clang/Basic/LangStandard.h> #include <clang/Basic/LangStandard.h>
#include <clang/Basic/TargetInfo.h> #include <clang/Basic/TargetInfo.h>
@ -40,7 +40,7 @@
#include <boost/range/combine.hpp> #include <boost/range/combine.hpp>
#include <boost/scope_exit.hpp> #include <boost/scope_exit.hpp>
#include "Metrics.h" #include "oi/Metrics.h"
extern "C" { extern "C" {
#include <llvm-c/Disassembler.h> #include <llvm-c/Disassembler.h>

View File

@ -25,8 +25,8 @@
#include <string_view> #include <string_view>
#include <unordered_map> #include <unordered_map>
#include "SymbolService.h" #include "oi/SymbolService.h"
#include "X86InstDefs.h" #include "oi/X86InstDefs.h"
namespace fs = std::filesystem; namespace fs = std::filesystem;

View File

@ -29,14 +29,14 @@ extern "C" {
#include <libgen.h> #include <libgen.h>
} }
#include "Features.h" #include "oi/Features.h"
#include "Metrics.h" #include "oi/Metrics.h"
#include "OIDebugger.h" #include "oi/OIDebugger.h"
#include "OIOpts.h" #include "oi/OIOpts.h"
#include "OIUtils.h" #include "oi/OIUtils.h"
#include "PaddingHunter.h" #include "oi/PaddingHunter.h"
#include "TimeUtils.h" #include "oi/TimeUtils.h"
#include "TreeBuilder.h" #include "oi/TreeBuilder.h"
/* Global for signal handling */ /* Global for signal handling */
std::weak_ptr<OIDebugger> weak_oid; std::weak_ptr<OIDebugger> weak_oid;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "OIDebugger.h" #include "oi/OIDebugger.h"
#include <folly/Varint.h> #include <folly/Varint.h>
@ -44,12 +44,12 @@ extern "C" {
#include <glog/logging.h> #include <glog/logging.h>
#include "ContainerInfo.h" #include "oi/ContainerInfo.h"
#include "Metrics.h" #include "oi/Metrics.h"
#include "OILexer.h" #include "oi/OILexer.h"
#include "OIUtils.h" #include "oi/OIUtils.h"
#include "PaddingHunter.h" #include "oi/PaddingHunter.h"
#include "Syscall.h" #include "oi/Syscall.h"
#ifndef OSS_ENABLE #ifndef OSS_ENABLE
#include "cea/object-introspection/internal/GobsService.h" #include "cea/object-introspection/internal/GobsService.h"

View File

@ -20,14 +20,14 @@
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
#include "OICache.h" #include "oi/OICache.h"
#include "OICodeGen.h" #include "oi/OICodeGen.h"
#include "OICompiler.h" #include "oi/OICompiler.h"
#include "OIParser.h" #include "oi/OIParser.h"
#include "SymbolService.h" #include "oi/SymbolService.h"
#include "TrapInfo.h" #include "oi/TrapInfo.h"
#include "TreeBuilder.h" #include "oi/TreeBuilder.h"
#include "X86InstDefs.h" #include "oi/X86InstDefs.h"
namespace fs = std::filesystem; namespace fs = std::filesystem;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include "OIGenerator.h" #include "oi/OIGenerator.h"
#include <glog/logging.h> #include <glog/logging.h>
@ -24,8 +24,8 @@
#include <unordered_map> #include <unordered_map>
#include <variant> #include <variant>
#include "DrgnUtils.h" #include "oi/DrgnUtils.h"
#include "OIUtils.h" #include "oi/OIUtils.h"
namespace ObjectIntrospection { namespace ObjectIntrospection {

View File

@ -18,9 +18,9 @@
#include <filesystem> #include <filesystem>
#include "DrgnUtils.h" #include "oi/DrgnUtils.h"
#include "OICodeGen.h" #include "oi/OICodeGen.h"
#include "OICompiler.h" #include "oi/OICompiler.h"
namespace ObjectIntrospection { namespace ObjectIntrospection {

View File

@ -18,7 +18,7 @@
/* C++ string header, for string ops below */ /* C++ string header, for string ops below */
#include <string> #include <string>
/* Implementation of yyFlexScanner */ /* Implementation of yyFlexScanner */
#include "OILexer.h" #include "oi/OILexer.h"
#undef YY_DECL #undef YY_DECL
#define YY_DECL \ #define YY_DECL \
int ObjectIntrospection::OIScanner::yylex(ObjectIntrospection::OIParser::semantic_type * const lval, \ int ObjectIntrospection::OIScanner::yylex(ObjectIntrospection::OIParser::semantic_type * const lval, \

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "OILibraryImpl.h" #include "oi/OILibraryImpl.h"
bool debug = false; bool debug = false;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "OILibraryImpl.h" #include "oi/OILibraryImpl.h"
#include <fcntl.h> #include <fcntl.h>
#include <glog/logging.h> #include <glog/logging.h>
@ -25,8 +25,8 @@
#include <boost/format.hpp> #include <boost/format.hpp>
#include <fstream> #include <fstream>
#include "OIParser.h" #include "oi/OIParser.h"
#include "OIUtils.h" #include "oi/OIUtils.h"
extern "C" { extern "C" {
#include <libelf.h> #include <libelf.h>

View File

@ -15,10 +15,10 @@
*/ */
#pragma once #pragma once
#include "OICodeGen.h"
#include "OICompiler.h"
#include "ObjectIntrospection.h" #include "ObjectIntrospection.h"
#include "SymbolService.h" #include "oi/OICodeGen.h"
#include "oi/OICompiler.h"
#include "oi/SymbolService.h"
namespace ObjectIntrospection { namespace ObjectIntrospection {

View File

@ -54,8 +54,8 @@
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <glog/logging.h> #include <glog/logging.h>
#include "OIParser.h" #include "oi/OIParser.h"
#include "OILexer.h" #include "oi/OILexer.h"
#undef yylex #undef yylex
#define yylex scanner.yylex #define yylex scanner.yylex

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "OIUtils.h" #include "oi/OIUtils.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <toml++/toml.h> #include <toml++/toml.h>

View File

@ -18,9 +18,9 @@
#include <optional> #include <optional>
#include <set> #include <set>
#include "Features.h" #include "oi/Features.h"
#include "OICodeGen.h" #include "oi/OICodeGen.h"
#include "OICompiler.h" #include "oi/OICompiler.h"
namespace OIUtils { namespace OIUtils {

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "PaddingHunter.h" #include "oi/PaddingHunter.h"
#include <algorithm> #include <algorithm>
#include <fstream> #include <fstream>

View File

@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "Serialize.h" #include "oi/Serialize.h"
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/serialization/serialization.hpp> #include <boost/serialization/serialization.hpp>
#include <boost/serialization/version.hpp> #include <boost/serialization/version.hpp>
#include <stdexcept> #include <stdexcept>
#include "DrgnUtils.h" #include "oi/DrgnUtils.h"
namespace boost::serialization { namespace boost::serialization {

View File

@ -24,9 +24,9 @@
#include <boost/serialization/unordered_map.hpp> #include <boost/serialization/unordered_map.hpp>
#include <boost/serialization/vector.hpp> #include <boost/serialization/vector.hpp>
#include "Common.h" #include "oi/Common.h"
#include "PaddingHunter.h" #include "oi/PaddingHunter.h"
#include "SymbolService.h" #include "oi/SymbolService.h"
#define DEFINE_TYPE_VERSION(Type, size, version) \ #define DEFINE_TYPE_VERSION(Type, size, version) \
static_assert( \ static_assert( \

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "SymbolService.h" #include "oi/SymbolService.h"
#include <glog/logging.h> #include <glog/logging.h>
@ -23,8 +23,8 @@
#include <cstring> #include <cstring>
#include <fstream> #include <fstream>
#include "DrgnUtils.h" #include "oi/DrgnUtils.h"
#include "OIParser.h" #include "oi/OIParser.h"
extern "C" { extern "C" {
#include <elfutils/known-dwarf.h> #include <elfutils/known-dwarf.h>

View File

@ -23,8 +23,8 @@
#include <variant> #include <variant>
#include <vector> #include <vector>
#include "Common.h" #include "oi/Common.h"
#include "Descs.h" #include "oi/Descs.h"
namespace fs = std::filesystem; namespace fs = std::filesystem;

View File

@ -18,8 +18,8 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include "Metrics.h" #include "oi/Metrics.h"
#include "OICompiler.h" #include "oi/OICompiler.h"
extern "C" { extern "C" {
#include <sys/user.h> #include <sys/user.h>

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "TreeBuilder.h" #include "oi/TreeBuilder.h"
#include <glog/logging.h> #include <glog/logging.h>
@ -25,11 +25,11 @@
#include <msgpack.hpp> #include <msgpack.hpp>
#include <stdexcept> #include <stdexcept>
#include "ContainerInfo.h" #include "oi/ContainerInfo.h"
#include "DrgnUtils.h" #include "oi/DrgnUtils.h"
#include "Metrics.h" #include "oi/Metrics.h"
#include "OICodeGen.h" #include "oi/OICodeGen.h"
#include "PaddingHunter.h" #include "oi/PaddingHunter.h"
#include "rocksdb/db.h" #include "rocksdb/db.h"
#include "rocksdb/options.h" #include "rocksdb/options.h"
#include "rocksdb/statistics.h" #include "rocksdb/statistics.h"

View File

@ -23,8 +23,8 @@
#include <unordered_set> #include <unordered_set>
#include <vector> #include <vector>
#include "Common.h" #include "oi/Common.h"
#include "Features.h" #include "oi/Features.h"
// The rocksdb includes are extremely heavy and bloat compile times, // The rocksdb includes are extremely heavy and bloat compile times,
// so we just forward-declare `DB` to avoid making other compile units // so we just forward-declare `DB` to avoid making other compile units

View File

@ -14,7 +14,7 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include "OIOpts.h" #include "oi/OIOpts.h"
using namespace std::literals; using namespace std::literals;

View File

@ -7,7 +7,7 @@
#include <cstring> #include <cstring>
#include <filesystem> #include <filesystem>
#include "OICompiler.h" #include "oi/OICompiler.h"
namespace fs = std::filesystem; namespace fs = std::filesystem;

View File

@ -4,8 +4,8 @@
#include <sstream> #include <sstream>
#include "OILexer.h" #include "oi/OILexer.h"
#include "OIParser.h" #include "oi/OIParser.h"
using ::testing::HasSubstr; using ::testing::HasSubstr;

View File

@ -20,9 +20,9 @@
#include <filesystem> #include <filesystem>
#include <iostream> #include <iostream>
#include "OICodeGen.h" #include "oi/OICodeGen.h"
#include "OIGenerator.h" #include "oi/OIGenerator.h"
#include "OIOpts.h" #include "oi/OIOpts.h"
namespace fs = std::filesystem; namespace fs = std::filesystem;
using namespace ObjectIntrospection; using namespace ObjectIntrospection;

View File

@ -19,9 +19,9 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include "OICompiler.h" #include "oi/OICompiler.h"
#include "PaddingHunter.h" #include "oi/PaddingHunter.h"
#include "Serialize.h" #include "oi/Serialize.h"
namespace fs = std::filesystem; namespace fs = std::filesystem;

View File

@ -21,12 +21,12 @@
#include <map> #include <map>
#include <span> #include <span>
#include "Common.h"
#include "OIOpts.h"
#include "PaddingHunter.h"
#include "Serialize.h"
#include "TreeBuilder.h"
#include "glog/vlog_is_on.h" #include "glog/vlog_is_on.h"
#include "oi/Common.h"
#include "oi/OIOpts.h"
#include "oi/PaddingHunter.h"
#include "oi/Serialize.h"
#include "oi/TreeBuilder.h"
namespace fs = std::filesystem; namespace fs = std::filesystem;