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}")
if (STATIC_LINK)
# 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
@ -223,15 +221,15 @@ endif()
# 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.
# 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 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)
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)
@ -239,17 +237,17 @@ add_library(oid_parser STATIC ${BISON_Parser_OUTPUTS} ${FLEX_Lexer_OUTPUTS})
target_link_libraries(oid_parser glog::glog)
### 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
src/Descs.cpp
src/Metrics.cpp
src/OICache.cpp
src/OICompiler.cpp
src/OIUtils.cpp
src/PaddingHunter.cpp
src/Serialize.cpp
oi/Descs.cpp
oi/Metrics.cpp
oi/OICache.cpp
oi/OICompiler.cpp
oi/OIUtils.cpp
oi/PaddingHunter.cpp
oi/Serialize.cpp
)
add_dependencies(oicore libdrgn)
set_project_warnings(oicore)
@ -290,7 +288,7 @@ target_link_libraries(oicore
)
### TreeBuilder
add_library(treebuilder src/TreeBuilder.cpp)
add_library(treebuilder oi/TreeBuilder.cpp)
add_dependencies(treebuilder librocksdb)
target_link_libraries(treebuilder
${rocksdb_BINARY_DIR}/librocksdb.a
@ -302,15 +300,16 @@ target_link_libraries(treebuilder
## OI Outputs
### 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_link_libraries(oil oicore)
### Object Introspection as a Library Generator (OILGen)
add_executable(oilgen
tools/OILGen.cpp
src/OIGenerator.cpp
oi/OIGenerator.cpp
)
target_link_libraries(oilgen
drgn_utils
oicore
@ -327,7 +326,7 @@ set_project_warnings(oitb)
target_link_libraries(oitb oicore treebuilder)
### 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)
target_link_libraries(oid oicore oid_parser treebuilder)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@
/* C++ string header, for string ops below */
#include <string>
/* Implementation of yyFlexScanner */
#include "OILexer.h"
#include "oi/OILexer.h"
#undef YY_DECL
#define YY_DECL \
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
* limitations under the License.
*/
#include "OILibraryImpl.h"
#include "oi/OILibraryImpl.h"
bool debug = false;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,12 +21,12 @@
#include <map>
#include <span>
#include "Common.h"
#include "OIOpts.h"
#include "PaddingHunter.h"
#include "Serialize.h"
#include "TreeBuilder.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;