clang-format: set BinPackParameters=false

This commit is contained in:
Jake Hillion 2023-04-18 10:02:37 -07:00 committed by Jake Hillion
parent 789fb7ef6e
commit 4a64fc5c9c
26 changed files with 241 additions and 113 deletions

View File

@ -8,3 +8,4 @@ AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
DerivePointerAlignment: false
PointerAlignment: Left
BinPackParameters: false

View File

@ -54,7 +54,9 @@ void Metrics::save(std::string object) {
}
}
void Metrics::saveArg(const char* name, const char* argName, ArgTiming timing,
void Metrics::saveArg(const char* name,
const char* argName,
ArgTiming timing,
size_t size) {
std::string out = "{\"type\": \"size\", \"traceName\": \"";
out += name;

View File

@ -58,7 +58,9 @@ class Metrics {
}
static void save(std::string object);
static void saveArg(const char* name, const char* argName, ArgTiming timing,
static void saveArg(const char* name,
const char* argName,
ArgTiming timing,
size_t size);
static void saveDuration(const char* name,
std::chrono::milliseconds duration);

View File

@ -145,8 +145,10 @@ class CodegenHandler {
return lib->getObjectSize((void*)&objectAddr, objectSize);
}
static int getObjectSize(const T& objectAddr, size_t& objectSize,
const options& opts, bool checkOptions = true) {
static int getObjectSize(const T& objectAddr,
size_t& objectSize,
const options& opts,
bool checkOptions = true) {
OILibrary* lib;
if (int responseCode = getLibrary(lib, opts, checkOptions);
responseCode != Response::OIL_SUCCESS) {
@ -180,7 +182,8 @@ class CodegenHandler {
return Response::OIL_SUCCESS;
}
static int getLibrary(OILibrary*& result, const options& opts,
static int getLibrary(OILibrary*& result,
const options& opts,
bool checkOptions) {
std::atomic<OILibrary*>* curBoxedLib = getBoxedLib()->load();
@ -224,7 +227,9 @@ class CodegenHandler {
* Ahead-Of-Time (AOT) compilation.
*/
template <class T>
int getObjectSize(const T& objectAddr, size_t& objectSize, const options& opts,
int getObjectSize(const T& objectAddr,
size_t& objectSize,
const options& opts,
bool checkOptions = true) {
return CodegenHandler<T>::getObjectSize(objectAddr, objectSize, opts,
checkOptions);

View File

@ -36,9 +36,11 @@ struct ContainerInfo {
ContainerInfo& operator=(const ContainerInfo& other) = delete;
ContainerInfo() = default;
ContainerInfo(std::string typeName_, std::regex matcher_,
ContainerInfo(std::string typeName_,
std::regex matcher_,
std::optional<size_t> numTemplateParams_,
ContainerTypeEnum ctype_, std::string header_,
ContainerTypeEnum ctype_,
std::string header_,
std::vector<std::string> ns_,
std::vector<size_t> replaceTemplateParamIndex_,
std::optional<size_t> allocatorIndex_,

View File

@ -98,7 +98,8 @@ const char* symbol::name(drgn_symbol* sym) {
namespace drgn_utils {
void getDrgnArrayElementType(drgn_type* type, drgn_type** outElemType,
void getDrgnArrayElementType(drgn_type* type,
drgn_type** outElemType,
size_t& outNumElems) {
size_t elems = 1;

View File

@ -137,7 +137,8 @@ namespace drgn_utils {
* data can be moved here.
*/
void getDrgnArrayElementType(drgn_type* type, drgn_type** outElemType,
void getDrgnArrayElementType(drgn_type* type,
drgn_type** outElemType,
size_t& outNumElems);
std::string typeToName(drgn_type* type);

View File

@ -330,7 +330,8 @@ std::string OICodeGen::stripFullyQualifiedNameWithSeparators(
// Replace a specific template parameter with a generic DummySizedOperator
void OICodeGen::replaceTemplateOperator(
TemplateParamList& template_params,
std::vector<std::string>& template_params_strings, size_t index) {
std::vector<std::string>& template_params_strings,
size_t index) {
if (index >= template_params.size()) {
// Should this happen?
return;
@ -365,7 +366,8 @@ void OICodeGen::replaceTemplateOperator(
}
void OICodeGen::replaceTemplateParameters(
drgn_type* type, TemplateParamList& template_params,
drgn_type* type,
TemplateParamList& template_params,
std::vector<std::string>& template_params_strings,
const std::string& nameWithoutTemplate) {
auto optContainerInfo = getContainerInfo(type);
@ -393,7 +395,8 @@ void OICodeGen::replaceTemplateParameters(
}
}
bool OICodeGen::buildName(drgn_type* type, std::string& text,
bool OICodeGen::buildName(drgn_type* type,
std::string& text,
std::string& outName) {
int ptrDepth = 0;
drgn_type* ut = type;
@ -418,7 +421,8 @@ bool OICodeGen::buildName(drgn_type* type, std::string& text,
return true;
}
bool OICodeGen::buildNameInt(drgn_type* type, std::string& nameWithoutTemplate,
bool OICodeGen::buildNameInt(drgn_type* type,
std::string& nameWithoutTemplate,
std::string& outName) {
// Calling buildName only makes sense if a type is a container and has
// template parameters. For a generic template class, we just flatten the
@ -588,7 +592,8 @@ bool OICodeGen::buildNameInt(drgn_type* type, std::string& nameWithoutTemplate,
}
bool OICodeGen::getTemplateParams(
drgn_type* type, size_t numTemplateParams,
drgn_type* type,
size_t numTemplateParams,
std::vector<std::pair<drgn_qualified_type, std::string>>& v) {
drgn_type_template_parameter* tParams = drgn_type_template_parameters(type);
@ -1662,8 +1667,10 @@ std::optional<std::string> OICodeGen::getNameForType(drgn_type* type) {
}
void OICodeGen::getFuncDefClassMembers(
std::string& code, drgn_type* type,
std::unordered_map<std::string, int>& memberNames, bool skipPadding) {
std::string& code,
drgn_type* type,
std::unordered_map<std::string, int>& memberNames,
bool skipPadding) {
if (drgn_type_kind(type) == DRGN_TYPE_TYPEDEF) {
// Handle case where parent is a typedef
getFuncDefClassMembers(code, drgnUnderlyingType(type), memberNames);
@ -1761,7 +1768,8 @@ void OICodeGen::enumerateDescendants(drgn_type* type, drgn_type* baseType) {
}
}
void OICodeGen::getFuncDefinitionStr(std::string& code, drgn_type* type,
void OICodeGen::getFuncDefinitionStr(std::string& code,
drgn_type* type,
const std::string& typeName) {
if (classMembersMap.find(type) == classMembersMap.end()) {
return;
@ -2380,8 +2388,10 @@ bool OICodeGen::addPadding(uint64_t padding_bits, std::string& code) {
return true;
}
static inline void addSizeComment(bool genPaddingStats, std::string& code,
size_t offset, size_t sizeInBits) {
static inline void addSizeComment(bool genPaddingStats,
std::string& code,
size_t offset,
size_t sizeInBits) {
if (!genPaddingStats) {
return;
}
@ -2417,8 +2427,10 @@ void OICodeGen::deduplicateMemberName(
std::optional<uint64_t> OICodeGen::generateMember(
const DrgnClassMemberInfo& m,
std::unordered_map<std::string, int>& memberNames, uint64_t currOffsetBits,
std::string& code, bool isInUnion) {
std::unordered_map<std::string, int>& memberNames,
uint64_t currOffsetBits,
std::string& code,
bool isInUnion) {
// Generate unique name for member
std::string memberName = m.member_name;
deduplicateMemberName(memberNames, memberName);
@ -2513,8 +2525,11 @@ std::optional<uint64_t> OICodeGen::generateMember(
}
bool OICodeGen::generateParent(
drgn_type* p, std::unordered_map<std::string, int>& memberNames,
uint64_t& currOffsetBits, std::string& code, size_t offsetToNextMember) {
drgn_type* p,
std::unordered_map<std::string, int>& memberNames,
uint64_t& currOffsetBits,
std::string& code,
size_t offsetToNextMember) {
// Parent class could be a typedef
PaddingInfo paddingInfo{};
bool violatesAlignmentRequirement = false;
@ -2606,9 +2621,13 @@ std::optional<uint64_t> OICodeGen::getAlignmentRequirements(drgn_type* e) {
}
bool OICodeGen::generateStructMembers(
drgn_type* e, std::unordered_map<std::string, int>& memberNames,
std::string& code, uint64_t& out_offset_bits, PaddingInfo& paddingInfo,
bool& violatesAlignmentRequirement, size_t offsetToNextMemberInSubclass) {
drgn_type* e,
std::unordered_map<std::string, int>& memberNames,
std::string& code,
uint64_t& out_offset_bits,
PaddingInfo& paddingInfo,
bool& violatesAlignmentRequirement,
size_t offsetToNextMemberInSubclass) {
if (classMembersMap.find(e) == classMembersMap.end()) {
VLOG(1) << "Failed to find type in classMembersMap: " << e;
}
@ -3632,8 +3651,10 @@ bool OICodeGen::generate(std::string& code) {
* Generate static_asserts for the offsets of each member of the given type
*/
bool OICodeGen::staticAssertMemberOffsets(
const std::string& struct_name, drgn_type* struct_type,
std::string& assert_str, std::unordered_map<std::string, int>& memberNames,
const std::string& struct_name,
drgn_type* struct_type,
std::string& assert_str,
std::unordered_map<std::string, int>& memberNames,
uint64_t base_offset) {
if (knownDummyTypeList.find(struct_type) != knownDummyTypeList.end()) {
return true;

View File

@ -224,7 +224,8 @@ class OICodeGen {
bool isKnownType(const std::string& type, std::string& matched);
static bool getTemplateParams(
drgn_type* type, size_t numTemplateParams,
drgn_type* type,
size_t numTemplateParams,
std::vector<std::pair<drgn_qualified_type, std::string>>& v);
bool enumerateTemplateParamIdxs(drgn_type* type,
@ -233,7 +234,8 @@ class OICodeGen {
bool& ifStub);
bool getContainerTemplateParams(drgn_type* type, bool& ifStub);
void enumerateDescendants(drgn_type* type, drgn_type* baseType);
void getFuncDefinitionStr(std::string& code, drgn_type* type,
void getFuncDefinitionStr(std::string& code,
drgn_type* type,
const std::string& typeName);
std::optional<uint64_t> getDrgnTypeSize(drgn_type* type);
@ -251,19 +253,24 @@ class OICodeGen {
std::optional<uint64_t> generateMember(
const DrgnClassMemberInfo& m,
std::unordered_map<std::string, int>& memberNames,
uint64_t currOffsetBits, std::string& code, bool isInUnion);
uint64_t currOffsetBits,
std::string& code,
bool isInUnion);
bool generateParent(drgn_type* p,
std::unordered_map<std::string, int>& memberNames,
uint64_t& currOffsetBits, std::string& code,
uint64_t& currOffsetBits,
std::string& code,
size_t offsetToNextMember);
std::optional<uint64_t> getAlignmentRequirements(drgn_type* e);
bool generateStructMembers(drgn_type* e,
std::unordered_map<std::string, int>& memberNames,
std::string& code, uint64_t& out_offset_bits,
std::string& code,
uint64_t& out_offset_bits,
PaddingInfo& paddingInfo,
bool& violatesAlignmentRequirement,
size_t offsetToNextMember);
void getFuncDefClassMembers(std::string& code, drgn_type* type,
void getFuncDefClassMembers(std::string& code,
drgn_type* type,
std::unordered_map<std::string, int>& memberNames,
bool skipPadding = false);
bool isDrgnSizeComplete(drgn_type* type);
@ -274,7 +281,8 @@ class OICodeGen {
bool ifEnumerateClass(const std::string& typeName);
bool enumerateClassParents(drgn_type* type, const std::string& typeName);
bool enumerateClassMembers(drgn_type* type, const std::string& typeName,
bool enumerateClassMembers(drgn_type* type,
const std::string& typeName,
bool& isStubbed);
bool enumerateClassTemplateParams(drgn_type* type,
const std::string& typeName,
@ -308,17 +316,21 @@ class OICodeGen {
void getClassMembersIncludingParent(drgn_type* type,
std::vector<DrgnClassMemberInfo>& out);
bool staticAssertMemberOffsets(
const std::string& struct_name, drgn_type* struct_type,
const std::string& struct_name,
drgn_type* struct_type,
std::string& assert_str,
std::unordered_map<std::string, int>& member_names,
uint64_t base_offset = 0);
bool addStaticAssertsForType(drgn_type* type, bool generateAssertsForOffsets,
bool addStaticAssertsForType(drgn_type* type,
bool generateAssertsForOffsets,
std::string& code);
bool buildNameInt(drgn_type* type, std::string& nameWithoutTemplate,
bool buildNameInt(drgn_type* type,
std::string& nameWithoutTemplate,
std::string& outName);
void replaceTemplateOperator(
std::vector<std::pair<drgn_qualified_type, std::string>>& template_params,
std::vector<std::string>& template_params_strings, size_t index);
std::vector<std::string>& template_params_strings,
size_t index);
void replaceTemplateParameters(
drgn_type* type,
std::vector<std::pair<drgn_qualified_type, std::string>>& template_params,

View File

@ -53,8 +53,10 @@ using namespace llvm::object;
using namespace ObjectIntrospection;
static const char* symbolLookupCallback(
[[maybe_unused]] void* disInfo, [[maybe_unused]] uint64_t referenceValue,
uint64_t* referenceType, [[maybe_unused]] uint64_t referencePC,
[[maybe_unused]] void* disInfo,
[[maybe_unused]] uint64_t referenceValue,
uint64_t* referenceType,
[[maybe_unused]] uint64_t referencePC,
[[maybe_unused]] const char** referenceName) {
*referenceType = LLVMDisassembler_ReferenceType_InOut_None;
return nullptr;
@ -233,13 +235,15 @@ class OIMemoryManager : public RTDyldMemoryManager {
bool needsToReserveAllocationSpace(void) override {
return true;
}
void reserveAllocationSpace(uintptr_t, uint32_t, uintptr_t, uint32_t,
uintptr_t, uint32_t) override;
void reserveAllocationSpace(
uintptr_t, uint32_t, uintptr_t, uint32_t, uintptr_t, uint32_t) override;
uint8_t* allocateCodeSection(uintptr_t, unsigned, unsigned,
uint8_t* allocateCodeSection(uintptr_t,
unsigned,
unsigned,
StringRef) override;
uint8_t* allocateDataSection(uintptr_t, unsigned, unsigned, StringRef,
bool) override;
uint8_t* allocateDataSection(
uintptr_t, unsigned, unsigned, StringRef, bool) override;
/* Hook to set up proper memory permission. We don't handle that */
bool finalizeMemory(std::string*) override {
@ -268,9 +272,12 @@ class OIMemoryManager : public RTDyldMemoryManager {
}
};
void OIMemoryManager::reserveAllocationSpace(
uintptr_t codeSize, uint32_t codeAlign, uintptr_t roDataSize,
uint32_t roDataAlign, uintptr_t rwDataSize, uint32_t rwDataAlign) {
void OIMemoryManager::reserveAllocationSpace(uintptr_t codeSize,
uint32_t codeAlign,
uintptr_t roDataSize,
uint32_t roDataAlign,
uintptr_t rwDataSize,
uint32_t rwDataAlign) {
/*
* It looks like the sizes given to us already take into account the
* alignment restrictions the different type of sections may have. Aligning
@ -294,7 +301,9 @@ void OIMemoryManager::reserveAllocationSpace(
}
uint8_t* OIMemoryManager::allocateCodeSection(
uintptr_t size, unsigned alignment, [[maybe_unused]] unsigned sectionID,
uintptr_t size,
unsigned alignment,
[[maybe_unused]] unsigned sectionID,
StringRef sectionName) {
VLOG(1) << "allocateCodeSection(Size = " << size
<< ", Alignment = " << alignment
@ -304,8 +313,11 @@ uint8_t* OIMemoryManager::allocateCodeSection(
}
uint8_t* OIMemoryManager::allocateDataSection(
uintptr_t size, unsigned alignment, [[maybe_unused]] unsigned sectionID,
StringRef sectionName, [[maybe_unused]] bool isReadOnly) {
uintptr_t size,
unsigned alignment,
[[maybe_unused]] unsigned sectionID,
StringRef sectionName,
[[maybe_unused]] bool isReadOnly) {
VLOG(1) << "allocateDataSection(Size = " << size
<< ", Alignment = " << alignment
<< ", SectionName = " << sectionName.data() << ")";
@ -451,7 +463,8 @@ static void debugDisAsm(
}
}
bool OICompiler::compile(const std::string& code, const fs::path& sourcePath,
bool OICompiler::compile(const std::string& code,
const fs::path& sourcePath,
const fs::path& objectPath) {
Metrics::Tracing _("compile");
@ -554,7 +567,8 @@ bool OICompiler::compile(const std::string& code, const fs::path& sourcePath,
}
std::optional<OICompiler::RelocResult> OICompiler::applyRelocs(
uintptr_t baseRelocAddress, const std::set<fs::path>& objectFiles,
uintptr_t baseRelocAddress,
const std::set<fs::path>& objectFiles,
const std::unordered_map<std::string, uintptr_t>& syntheticSymbols) {
Metrics::Tracing relocationTracing("relocation");

View File

@ -157,7 +157,8 @@ class OICompiler {
* another call.
*/
std::optional<RelocResult> applyRelocs(
uintptr_t, const std::set<fs::path>&,
uintptr_t,
const std::set<fs::path>&,
const std::unordered_map<std::string, uintptr_t>&);
/**

View File

@ -282,8 +282,10 @@ struct Config {
} // namespace Oid
static ExitStatus::ExitStatus runScript(
const std::string& fileName, std::istream& script,
const Oid::Config& oidConfig, const OICodeGen::Config& codeGenConfig,
const std::string& fileName,
std::istream& script,
const Oid::Config& oidConfig,
const OICodeGen::Config& codeGenConfig,
const OICompiler::Config& compilerConfig,
const TreeBuilder::Config& tbConfig) {
if (!fileName.empty()) {

View File

@ -143,7 +143,8 @@ uint64_t OIDebugger::singlestepInst(pid_t pid, struct user_regs_struct& regs) {
return regs.rip;
}
void OIDebugger::dumpRegs(const char* text, pid_t pid,
void OIDebugger::dumpRegs(const char* text,
pid_t pid,
struct user_regs_struct* regs) {
VLOG(1) << "(" << text << ")"
<< " dumpRegs: pid: " << std::dec << pid << std::hex << " rip "
@ -457,7 +458,8 @@ bool OIDebugger::contTargetThread(bool detach) const {
return true;
}
bool OIDebugger::replayTrappedInstr(const trapInfo& t, pid_t pid,
bool OIDebugger::replayTrappedInstr(const trapInfo& t,
pid_t pid,
struct user_regs_struct& regs,
struct user_fpregs_struct& fpregs) const {
/*
@ -558,7 +560,9 @@ bool OIDebugger::locateObjectsAddresses(const trapInfo& tInfo,
}
OIDebugger::processTrapRet OIDebugger::processFuncTrap(
const trapInfo& tInfo, pid_t pid, struct user_regs_struct& regs,
const trapInfo& tInfo,
pid_t pid,
struct user_regs_struct& regs,
struct user_fpregs_struct& fpregs) {
assert(tInfo.trapKind != OID_TRAP_JITCODERET);
@ -904,7 +908,8 @@ bool OIDebugger::canProcessTrapForThread(pid_t thread_pid) const {
* (default) we wait for any thread to stop, if false we wait for the thread
* specified by the first parameter 'pid' to stop.
*/
OIDebugger::processTrapRet OIDebugger::processTrap(pid_t pid, bool blocking,
OIDebugger::processTrapRet OIDebugger::processTrap(pid_t pid,
bool blocking,
bool anyPid) {
int status = 0;
pid_t newpid = 0;
@ -1868,7 +1873,8 @@ bool OIDebugger::removeTrap(pid_t pid, const trapInfo& t) {
return true;
}
OIDebugger::OIDebugger(OICodeGen::Config genConfig, OICompiler::Config ccConfig,
OIDebugger::OIDebugger(OICodeGen::Config genConfig,
OICompiler::Config ccConfig,
TreeBuilder::Config tbConfig)
: compilerConfig{std::move(ccConfig)},
generatorConfig{std::move(genConfig)},
@ -1879,11 +1885,12 @@ OIDebugger::OIDebugger(OICodeGen::Config genConfig, OICompiler::Config ccConfig,
VLOG(1) << "CodeGen config: " << generatorConfig.toString();
}
OIDebugger::OIDebugger(pid_t pid, OICodeGen::Config genConfig,
OIDebugger::OIDebugger(pid_t pid,
OICodeGen::Config genConfig,
OICompiler::Config ccConfig,
TreeBuilder::Config tbConfig)
: OIDebugger(std::move(genConfig), std::move(ccConfig),
std::move(tbConfig)) {
: OIDebugger(
std::move(genConfig), std::move(ccConfig), std::move(tbConfig)) {
traceePid = pid;
symbols = std::make_shared<SymbolService>(traceePid);
setDataSegmentSize(dataSegSize);
@ -1891,11 +1898,12 @@ OIDebugger::OIDebugger(pid_t pid, OICodeGen::Config genConfig,
cache.symbols = symbols;
}
OIDebugger::OIDebugger(fs::path debugInfo, OICodeGen::Config genConfig,
OIDebugger::OIDebugger(fs::path debugInfo,
OICodeGen::Config genConfig,
OICompiler::Config ccConfig,
TreeBuilder::Config tbConfig)
: OIDebugger(std::move(genConfig), std::move(ccConfig),
std::move(tbConfig)) {
: OIDebugger(
std::move(genConfig), std::move(ccConfig), std::move(tbConfig)) {
symbols = std::make_shared<SymbolService>(std::move(debugInfo));
cache.symbols = symbols;
}
@ -1910,7 +1918,8 @@ OIDebugger::OIDebugger(fs::path debugInfo, OICodeGen::Config genConfig,
* @param[in] target_addr - target address where new data are to be written
* @param[in] bufsz - length of 'target_addr' buffer in bytes
*/
bool OIDebugger::writeTargetMemory(void* local_buffer, void* target_addr,
bool OIDebugger::writeTargetMemory(void* local_buffer,
void* target_addr,
size_t bufsz) const {
VLOG(1) << "Writing buffer " << std::hex << local_buffer << ", bufsz "
<< std::dec << bufsz << " into target " << std::hex << target_addr;
@ -1953,7 +1962,8 @@ bool OIDebugger::writeTargetMemory(void* local_buffer, void* target_addr,
* @param[in] local_addr - local address where new data are to be written
* @param[in] bufsz - length of 'local_addr' buffer in bytes
*/
bool OIDebugger::readTargetMemory(void* remote_buffer, void* local_addr,
bool OIDebugger::readTargetMemory(void* remote_buffer,
void* local_addr,
size_t bufsz) const {
VLOG(1) << "Reading buffer " << std::hex << remote_buffer << ", bufsz "
<< std::dec << bufsz << " into local " << std::hex << local_addr;

View File

@ -36,7 +36,9 @@ class OIDebugger {
public:
OIDebugger(pid_t, OICodeGen::Config, OICompiler::Config, TreeBuilder::Config);
OIDebugger(fs::path, OICodeGen::Config, OICompiler::Config,
OIDebugger(fs::path,
OICodeGen::Config,
OICompiler::Config,
TreeBuilder::Config);
bool segmentInit(void);
@ -186,8 +188,9 @@ class OIDebugger {
std::unordered_map<pid_t, std::shared_ptr<trapInfo>> threadTrapState;
std::unordered_map<uintptr_t, uintptr_t> replayInstMap;
std::unordered_map<irequest, std::tuple<RootInfo, TypeHierarchy,
std::map<std::string, PaddingInfo>>>
std::unordered_map<
irequest,
std::tuple<RootInfo, TypeHierarchy, std::map<std::string, PaddingInfo>>>
typeInfos;
template <typename Sys, typename... Args>
@ -217,10 +220,13 @@ class OIDebugger {
const uint64_t);
bool functionPatch(const prequest&);
bool canProcessTrapForThread(pid_t) const;
bool replayTrappedInstr(const trapInfo&, pid_t, struct user_regs_struct&,
bool replayTrappedInstr(const trapInfo&,
pid_t,
struct user_regs_struct&,
struct user_fpregs_struct&) const;
bool locateObjectsAddresses(const trapInfo&, struct user_regs_struct&);
processTrapRet processFuncTrap(const trapInfo&, pid_t,
processTrapRet processFuncTrap(const trapInfo&,
pid_t,
struct user_regs_struct&,
struct user_fpregs_struct&);
processTrapRet processJitCodeRet(const trapInfo&, pid_t);

View File

@ -55,8 +55,10 @@ class OIGenerator {
std::filesystem::path generateForType(
const OICodeGen::Config& generatorConfig,
const OICompiler::Config& compilerConfig, const drgn_qualified_type& type,
const std::string& linkageName, SymbolService& symbols);
const OICompiler::Config& compilerConfig,
const drgn_qualified_type& type,
const std::string& linkageName,
SymbolService& symbols);
};
} // namespace ObjectIntrospection

View File

@ -32,8 +32,10 @@ using namespace ObjectIntrospection;
using namespace std::literals;
std::optional<std::set<Feature>> processConfigFile(
const std::string& configFilePath, std::map<Feature, bool> featureMap,
OICompiler::Config& compilerConfig, OICodeGen::Config& generatorConfig) {
const std::string& configFilePath,
std::map<Feature, bool> featureMap,
OICompiler::Config& compilerConfig,
OICodeGen::Config& generatorConfig) {
fs::path configDirectory = fs::path(configFilePath).remove_filename();
toml::table config;

View File

@ -25,7 +25,9 @@
namespace OIUtils {
std::optional<std::set<Feature>> processConfigFile(
const std::string& configFilePath, std::map<Feature, bool> featureMap,
OICompiler::Config& compilerConfig, OICodeGen::Config& generatorConfig);
const std::string& configFilePath,
std::map<Feature, bool> featureMap,
OICompiler::Config& compilerConfig,
OICodeGen::Config& generatorConfig);
} // namespace OIUtils

View File

@ -21,8 +21,12 @@
struct PaddingInfo {
public:
PaddingInfo() = default;
PaddingInfo(size_t strSize, int saveSz, size_t paddSz, size_t issetSz,
std::string def, size_t instCnt)
PaddingInfo(size_t strSize,
int saveSz,
size_t paddSz,
size_t issetSz,
std::string def,
size_t instCnt)
: structSize{strSize},
alignmentRequirement{8},
savingSize{static_cast<size_t>(saveSz)},

View File

@ -67,7 +67,8 @@ void serialize(Archive& ar, PaddingInfo& p, const unsigned int version) {
INSTANCIATE_SERIALIZE(PaddingInfo)
template <class Archive>
void serialize(Archive& ar, struct drgn_location_description& location,
void serialize(Archive& ar,
struct drgn_location_description& location,
const unsigned int version) {
verify_version<struct drgn_location_description>(version);
ar& location.start;
@ -86,7 +87,8 @@ void serialize(Archive& ar, struct drgn_location_description& location,
INSTANCIATE_SERIALIZE(struct drgn_location_description)
template <class Archive>
void serialize(Archive& ar, struct drgn_object_locator& locator,
void serialize(Archive& ar,
struct drgn_object_locator& locator,
const unsigned int version) {
verify_version<struct drgn_object_locator>(version);
ar& locator.module_start;
@ -124,7 +126,8 @@ void serialize(Archive& ar, FuncDesc::Arg& arg, const unsigned int version) {
INSTANCIATE_SERIALIZE(FuncDesc::Arg)
template <class Archive>
void serialize(Archive& ar, FuncDesc::Retval& retval,
void serialize(Archive& ar,
FuncDesc::Retval& retval,
const unsigned int version) {
verify_version<FuncDesc::Retval>(version);
ar& retval.typeName;
@ -134,7 +137,8 @@ void serialize(Archive& ar, FuncDesc::Retval& retval,
INSTANCIATE_SERIALIZE(FuncDesc::Retval)
template <class Archive>
void serialize(Archive& ar, FuncDesc::Range& range,
void serialize(Archive& ar,
FuncDesc::Range& range,
const unsigned int version) {
verify_version<FuncDesc::Range>(version);
ar& range.start;
@ -188,7 +192,8 @@ static void serialize_c_string(Archive& ar, char** string) {
// what you're doing (or ask someone who does) before touching anything.
// ###########################################################################
template <class Archive>
void serialize(Archive& ar, struct drgn_type& type,
void serialize(Archive& ar,
struct drgn_type& type,
const unsigned int version) {
#define assert_in_same_union(member_1, member_2) \
do { \
@ -307,7 +312,8 @@ void serialize(Archive& ar, struct drgn_type& type,
INSTANCIATE_SERIALIZE(struct drgn_type)
template <class Archive>
void serialize(Archive& ar, struct DrgnClassMemberInfo& m,
void serialize(Archive& ar,
struct DrgnClassMemberInfo& m,
const unsigned int version) {
verify_version<struct DrgnClassMemberInfo>(version);
ar& m.type;
@ -319,7 +325,8 @@ void serialize(Archive& ar, struct DrgnClassMemberInfo& m,
INSTANCIATE_SERIALIZE(DrgnClassMemberInfo)
template <class Archive>
void serialize(Archive& ar, struct drgn_qualified_type& type,
void serialize(Archive& ar,
struct drgn_qualified_type& type,
const unsigned int version) {
verify_version<struct drgn_qualified_type>(version);
ar& type.type;
@ -338,7 +345,8 @@ void serialize(Archive& ar, RootInfo& rootInfo, const unsigned int version) {
INSTANCIATE_SERIALIZE(RootInfo)
template <class Archive>
void serialize(Archive& ar, struct TypeHierarchy& th,
void serialize(Archive& ar,
struct TypeHierarchy& th,
const unsigned int version) {
verify_version<TypeHierarchy>(version);
ar& th.classMembersMap;

View File

@ -119,8 +119,11 @@ struct ModParams {
*
*/
static int moduleCallback(Dwfl_Module* mod, void** /* userData */,
const char* name, Dwarf_Addr /* start */, void* arg) {
static int moduleCallback(Dwfl_Module* mod,
void** /* userData */,
const char* name,
Dwarf_Addr /* start */,
void* arg) {
ModParams* m = (ModParams*)arg;
int nsym = dwfl_module_getsymtab(mod);
@ -296,8 +299,10 @@ static std::string bytesToHexString(const unsigned char* bytes, int nbbytes) {
* to this callback. So we always return DWARF_CB_ABORT, as this is
* the only build ID we are interested in.
*/
static int buildIDCallback(Dwfl_Module* mod, void** /* userData */,
const char* name, Dwarf_Addr /* start */,
static int buildIDCallback(Dwfl_Module* mod,
void** /* userData */,
const char* name,
Dwarf_Addr /* start */,
void* arg) {
auto* buildID = static_cast<std::optional<std::string>*>(arg);
@ -430,8 +435,10 @@ struct drgn_program* SymbolService::getDrgnProgram() {
* Although 'parseFormalParam' has an all-encompassing sounding name, its sole
* task is to extract the location information for this parameter if any exist.
*/
static void parseFormalParam(Dwarf_Die& param, struct drgn_module* module,
struct drgn_program* prog, Dwarf_Die& funcDie,
static void parseFormalParam(Dwarf_Die& param,
struct drgn_module* module,
struct drgn_program* prog,
Dwarf_Die& funcDie,
std::shared_ptr<FuncDesc>& fd) {
/*
* NOTE: It is vital that the function descriptors list of arguments

View File

@ -43,7 +43,9 @@ struct StringLiteral {
* know how to use the _Args to also statically check the type of the arguments.
* In the meantime, I can use the size of _Args to do a simple count check.
*/
template <StringLiteral _Name, unsigned long _SysNum, typename _RetType,
template <StringLiteral _Name,
unsigned long _SysNum,
typename _RetType,
typename... _Args>
struct Syscall {
/* User friendly syscall name */

View File

@ -177,9 +177,19 @@ struct TreeBuilder::Node {
*/
size_t exclusiveSize{};
MSGPACK_DEFINE_ARRAY(id, name, typeName, typePath, isTypedef, staticSize,
dynamicSize, paddingSavingsSize, containerStats, pointer,
children, isset, exclusiveSize)
MSGPACK_DEFINE_ARRAY(id,
name,
typeName,
typePath,
isTypedef,
staticSize,
dynamicSize,
paddingSavingsSize,
containerStats,
pointer,
children,
isset,
exclusiveSize)
};
TreeBuilder::~TreeBuilder() {
@ -214,7 +224,8 @@ bool TreeBuilder::emptyOutput() const {
}
void TreeBuilder::build(const std::vector<uint64_t>& data,
const std::string& argName, struct drgn_type* type,
const std::string& argName,
struct drgn_type* type,
const TypeHierarchy& typeHierarchy) {
th = &typeHierarchy;
oidData = &data;
@ -385,7 +396,8 @@ static std::string_view drgnKindStr(struct drgn_type* type) {
return kind;
}
void TreeBuilder::setSize(TreeBuilder::Node& node, uint64_t dynamicSize,
void TreeBuilder::setSize(TreeBuilder::Node& node,
uint64_t dynamicSize,
uint64_t memberSizes) {
node.dynamicSize = dynamicSize;
if (memberSizes > node.staticSize + node.dynamicSize) {

View File

@ -50,8 +50,10 @@ class TreeBuilder {
TreeBuilder(Config);
~TreeBuilder();
void build(const std::vector<uint64_t>&, const std::string&,
struct drgn_type*, const TypeHierarchy&);
void build(const std::vector<uint64_t>&,
const std::string&,
struct drgn_type*,
const TypeHierarchy&);
void dumpJson();
void setPaddedStructs(std::map<std::string, PaddingInfo>* paddedStructs);
bool emptyOutput() const;
@ -114,6 +116,7 @@ class TreeBuilder {
std::string_view serialize(const T&);
void JSON(NodeID id, std::ofstream& output);
static void setSize(TreeBuilder::Node& node, uint64_t dynamicSize,
static void setSize(TreeBuilder::Node& node,
uint64_t dynamicSize,
uint64_t memberSizes);
};

View File

@ -295,7 +295,8 @@ OidProc OidIntegration::runOidOnProcess(OidOpts opts,
void OidIntegration::compare_json(const bpt::ptree& expected_json,
const bpt::ptree& actual_json,
const std::string& full_key, bool expect_eq) {
const std::string& full_key,
bool expect_eq) {
if (expected_json.empty()) {
if (expect_eq) {
ASSERT_EQ(expected_json.data(), actual_json.data())
@ -358,7 +359,8 @@ std::string OilIntegration::TmpDirStr() {
return std::string("/tmp/oil-integration-XXXXXX");
}
Proc OilIntegration::runOilTarget(OidOpts opts, std::string configPrefix,
Proc OilIntegration::runOilTarget(OidOpts opts,
std::string configPrefix,
std::string configSuffix) {
fs::path thisConfig = createCustomConfig(configPrefix, configSuffix);

View File

@ -51,8 +51,10 @@ class OidIntegration : public IntegrationBase {
protected:
std::string TmpDirStr() override;
OidProc runOidOnProcess(OidOpts opts, std::vector<std::string> extra_args,
std::string configPrefix, std::string configSuffix);
OidProc runOidOnProcess(OidOpts opts,
std::vector<std::string> extra_args,
std::string configPrefix,
std::string configSuffix);
/*
* compare_json
@ -70,6 +72,7 @@ class OilIntegration : public IntegrationBase {
protected:
std::string TmpDirStr() override;
Proc runOilTarget(OidOpts opts, std::string configPrefix,
Proc runOilTarget(OidOpts opts,
std::string configPrefix,
std::string configSuffix);
};

View File

@ -34,7 +34,8 @@ static std::string parseBadString(const std::string& script) {
return testing::internal::GetCapturedStderr();
}
static void EXPECT_REQ_EQ(const prequest& req, const std::string& type,
static void EXPECT_REQ_EQ(const prequest& req,
const std::string& type,
const std::string& func,
const std::vector<std::string>& args) {
EXPECT_EQ(req.type, type);