fix C compilation of _plugins.h
This commit is contained in:
parent
dcd69c90b2
commit
b79e67f4b0
|
|
@ -172,6 +172,7 @@ set(dbg_SOURCES
|
|||
"src/dbg/WinInet-Downloader/downslib.cpp"
|
||||
"src/dbg/WinInet-Downloader/downslib.h"
|
||||
"src/dbg/XEDParse/XEDParse.h"
|
||||
"src/dbg/_apichecker.c"
|
||||
"src/dbg/_dbgfunctions.cpp"
|
||||
"src/dbg/_dbgfunctions.h"
|
||||
"src/dbg/_exports.cpp"
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ clang-any.compile-options = ["-Wno-self-assign-field"]
|
|||
type = "shared"
|
||||
sources = [
|
||||
"src/dbg/*.cpp",
|
||||
"src/dbg/*.c",
|
||||
"src/dbg/*.h",
|
||||
"src/dbg/analysis/*.cpp",
|
||||
"src/dbg/analysis/*.h",
|
||||
|
|
|
|||
|
|
@ -246,21 +246,21 @@ typedef struct
|
|||
void* reserved;
|
||||
} PLUG_CB_STOPTRACE;
|
||||
|
||||
enum class DbItemType
|
||||
typedef enum
|
||||
{
|
||||
Function,
|
||||
Label,
|
||||
Comment,
|
||||
Bookmark,
|
||||
Loop,
|
||||
Argument
|
||||
};
|
||||
DbItemTypeFunction,
|
||||
DbItemTypeLabel,
|
||||
DbItemTypeComment,
|
||||
DbItemTypeBookmark,
|
||||
DbItemTypeLoop,
|
||||
DbItemTypeArgument,
|
||||
} DbItemType;
|
||||
|
||||
enum class DbOperationType
|
||||
typedef enum
|
||||
{
|
||||
Add,
|
||||
Remove
|
||||
};
|
||||
DbOperationTypeAdd,
|
||||
DbOperationTypeRemove,
|
||||
} DbOperationType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
@ -268,6 +268,11 @@ typedef struct
|
|||
DbOperationType opType;
|
||||
union
|
||||
{
|
||||
struct // unknown
|
||||
{
|
||||
void* reserved;
|
||||
};
|
||||
|
||||
struct // comments, labels
|
||||
{
|
||||
const char* text;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ protected:
|
|||
|
||||
bool populateDbOperation(DbOperation & op, const ARGUMENTSINFO & value) const override
|
||||
{
|
||||
op.itemType = DbItemType::Argument;
|
||||
op.itemType = DbItemTypeArgument;
|
||||
op.modhash = value.modhash;
|
||||
op.address = value.start;
|
||||
op.end = value.end;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ struct Bookmarks : AddrInfoHashMap<LockBookmarks, BOOKMARKSINFO, BookmarkSeriali
|
|||
protected:
|
||||
bool populateDbOperation(DbOperation & op, const BOOKMARKSINFO & value) const override
|
||||
{
|
||||
op.itemType = DbItemType::Bookmark;
|
||||
op.itemType = DbItemTypeBookmark;
|
||||
op.modhash = value.modhash;
|
||||
op.address = value.addr;
|
||||
op.manual = value.manual;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ struct Comments : AddrInfoHashMap<LockComments, COMMENTSINFO, CommentSerializer>
|
|||
protected:
|
||||
bool populateDbOperation(DbOperation & op, const COMMENTSINFO & value) const override
|
||||
{
|
||||
op.itemType = DbItemType::Comment;
|
||||
op.itemType = DbItemTypeComment;
|
||||
op.modhash = value.modhash;
|
||||
op.address = value.addr;
|
||||
op.text = value.text.c_str();
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ void DbCallbackBatcher::Add(DbOperation & op)
|
|||
|
||||
if(batcher != nullptr)
|
||||
{
|
||||
if(op.text != nullptr && (op.itemType == DbItemType::Comment || op.itemType == DbItemType::Label)) // save c string in temporary string vector which will be cleared on flush
|
||||
if(op.text != nullptr && (op.itemType == DbItemTypeComment || op.itemType == DbItemTypeLabel)) // save c string in temporary string vector which will be cleared on flush
|
||||
{
|
||||
batcher->mStrings.emplace_back(op.text);
|
||||
op.text = batcher->mStrings.back().c_str();
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ protected:
|
|||
|
||||
bool populateDbOperation(DbOperation & op, const FUNCTIONSINFO & value) const override
|
||||
{
|
||||
op.itemType = DbItemType::Function;
|
||||
op.itemType = DbItemTypeFunction;
|
||||
op.modhash = value.modhash;
|
||||
op.address = value.start;
|
||||
op.end = value.end;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ struct Labels : AddrInfoHashMap<LockLabels, LABELSINFO, LabelSerializer>
|
|||
protected:
|
||||
bool populateDbOperation(DbOperation & op, const LABELSINFO & value) const override
|
||||
{
|
||||
op.itemType = DbItemType::Label;
|
||||
op.itemType = DbItemTypeLabel;
|
||||
op.modhash = value.modhash;
|
||||
op.address = value.addr;
|
||||
op.text = value.text.c_str();
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ static std::map<DepthModuleRange, LOOPSINFO, DepthModuleRangeCompare> loops;
|
|||
|
||||
static void populateDbOperation(DbOperation & op, const LOOPSINFO & info)
|
||||
{
|
||||
op.itemType = DbItemType::Loop;
|
||||
op.itemType = DbItemTypeLoop;
|
||||
op.modhash = info.modhash;
|
||||
op.address = info.start;
|
||||
op.end = info.end;
|
||||
|
|
@ -108,7 +108,7 @@ bool LoopAdd(duint Start, duint End, bool Manual, duint instructionCount)
|
|||
// shifts are not reported to plugins (DbOperationType has no Update). Only the new
|
||||
// loop's Add is surfaced here, consistent with the function callback behavior.
|
||||
DbOperation op {};
|
||||
op.opType = DbOperationType::Add;
|
||||
op.opType = DbOperationTypeAdd;
|
||||
populateDbOperation(op, loopInfo);
|
||||
|
||||
DbCallbackBatcher::Add(op);
|
||||
|
|
@ -212,7 +212,7 @@ void LoopDeleteRange(duint Start, duint End)
|
|||
for(const LOOPSINFO & loop : erasedLoops)
|
||||
{
|
||||
DbOperation op {};
|
||||
op.opType = DbOperationType::Remove;
|
||||
op.opType = DbOperationTypeRemove;
|
||||
populateDbOperation(op, loop);
|
||||
|
||||
DbCallbackBatcher::Add(op);
|
||||
|
|
@ -247,7 +247,7 @@ bool LoopDelete(int Depth, duint Address)
|
|||
for(const LOOPSINFO & loop : erasedLoops)
|
||||
{
|
||||
DbOperation op {};
|
||||
op.opType = DbOperationType::Remove;
|
||||
op.opType = DbOperationTypeRemove;
|
||||
populateDbOperation(op, loop);
|
||||
|
||||
DbCallbackBatcher::Add(op);
|
||||
|
|
@ -331,7 +331,7 @@ void LoopCacheLoad(JSON Root)
|
|||
loops[DepthModuleRange(loopInfo.depth, ModuleRange(loopInfo.modhash, Range(loopInfo.start, loopInfo.end)))] = loopInfo;
|
||||
|
||||
DbOperation op {};
|
||||
op.opType = DbOperationType::Add;
|
||||
op.opType = DbOperationTypeAdd;
|
||||
populateDbOperation(op, loopInfo);
|
||||
|
||||
DbCallbackBatcher::Add(op);
|
||||
|
|
@ -393,7 +393,7 @@ void LoopClear()
|
|||
for(auto & itr : empty)
|
||||
{
|
||||
DbOperation op {};
|
||||
op.opType = DbOperationType::Remove;
|
||||
op.opType = DbOperationTypeRemove;
|
||||
populateDbOperation(op, itr.second);
|
||||
|
||||
DbCallbackBatcher::Add(op);
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ public:
|
|||
if(added)
|
||||
{
|
||||
DbOperation op {};
|
||||
op.opType = DbOperationType::Add;
|
||||
op.opType = DbOperationTypeAdd;
|
||||
|
||||
if(populateDbOperation(op, value))
|
||||
{
|
||||
|
|
@ -164,7 +164,7 @@ public:
|
|||
if(erased)
|
||||
{
|
||||
DbOperation op {};
|
||||
op.opType = DbOperationType::Remove;
|
||||
op.opType = DbOperationTypeRemove;
|
||||
|
||||
if(populateDbOperation(op, value))
|
||||
{
|
||||
|
|
@ -194,7 +194,7 @@ public:
|
|||
for(const TValue & value : erased)
|
||||
{
|
||||
DbOperation op {};
|
||||
op.opType = DbOperationType::Remove;
|
||||
op.opType = DbOperationTypeRemove;
|
||||
|
||||
if(populateDbOperation(op, value))
|
||||
{
|
||||
|
|
@ -223,7 +223,7 @@ public:
|
|||
for(const auto & kv : empty)
|
||||
{
|
||||
DbOperation op {};
|
||||
op.opType = DbOperationType::Remove;
|
||||
op.opType = DbOperationTypeRemove;
|
||||
|
||||
if(populateDbOperation(op, kv.second))
|
||||
{
|
||||
|
|
@ -268,7 +268,7 @@ public:
|
|||
if(addNoLock(value))
|
||||
{
|
||||
DbOperation op {};
|
||||
op.opType = DbOperationType::Add;
|
||||
op.opType = DbOperationTypeAdd;
|
||||
|
||||
if(populateDbOperation(op, value))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace
|
|||
DbOperation & operation = info->operations[i];
|
||||
std::string saved = "";
|
||||
|
||||
if(operation.text && (operation.itemType == DbItemType::Comment || operation.itemType == DbItemType::Label))
|
||||
if(operation.text && (operation.itemType == DbItemTypeComment || operation.itemType == DbItemTypeLabel))
|
||||
{
|
||||
saved = std::string(operation.text);
|
||||
}
|
||||
|
|
@ -71,9 +71,9 @@ namespace
|
|||
static bool getOpType(char s, DbOperationType & type)
|
||||
{
|
||||
if(s == 'a')
|
||||
type = DbOperationType::Add;
|
||||
type = DbOperationTypeAdd;
|
||||
else if(s == 'r')
|
||||
type = DbOperationType::Remove;
|
||||
type = DbOperationTypeRemove;
|
||||
else
|
||||
return false;
|
||||
|
||||
|
|
@ -83,17 +83,17 @@ namespace
|
|||
static bool getItemType(char s, DbItemType & type)
|
||||
{
|
||||
if(s == 'f')
|
||||
type = DbItemType::Function;
|
||||
type = DbItemTypeFunction;
|
||||
else if(s == 'l')
|
||||
type = DbItemType::Label;
|
||||
type = DbItemTypeLabel;
|
||||
else if(s == 'c')
|
||||
type = DbItemType::Comment;
|
||||
type = DbItemTypeComment;
|
||||
else if(s == 'b')
|
||||
type = DbItemType::Bookmark;
|
||||
type = DbItemTypeBookmark;
|
||||
else if(s == 'p')
|
||||
type = DbItemType::Loop;
|
||||
type = DbItemTypeLoop;
|
||||
else if(s == 'g')
|
||||
type = DbItemType::Argument;
|
||||
type = DbItemTypeArgument;
|
||||
else
|
||||
return false;
|
||||
|
||||
|
|
@ -135,21 +135,21 @@ namespace
|
|||
bool bulk = (bool) evalExpr(argv[5]);
|
||||
|
||||
const char* text = NULL;
|
||||
if((itemType == DbItemType::Label || itemType == DbItemType::Comment) && argc >= 7)
|
||||
if((itemType == DbItemTypeLabel || itemType == DbItemTypeComment) && argc >= 7)
|
||||
{
|
||||
text = argv[6];
|
||||
if(!_plugin_testassert(last.text == text, "text passed to callback doesn't match (%s != %s)", last.text.c_str(), text))
|
||||
return false;
|
||||
}
|
||||
|
||||
if((itemType == DbItemType::Function || itemType == DbItemType::Argument || itemType == DbItemType::Loop) && argc >= 7)
|
||||
if((itemType == DbItemTypeFunction || itemType == DbItemTypeArgument || itemType == DbItemTypeLoop) && argc >= 7)
|
||||
{
|
||||
const duint end = evalExpr(argv[6]);
|
||||
if(!_plugin_testassert(last.operation.end == end, "end passed to callback doesn't match (%llu != %llu)", last.operation.end, end))
|
||||
return false;
|
||||
}
|
||||
|
||||
if(itemType == DbItemType::Loop && argc >= 8)
|
||||
if(itemType == DbItemTypeLoop && argc >= 8)
|
||||
{
|
||||
const int depth = (int) evalExpr(argv[7]);
|
||||
if(!_plugin_testassert(last.operation.depth == depth, "depth passed to callback doesn't match (%d != %d)", last.operation.depth, depth))
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ extern "C"
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
Sleep(1000);
|
||||
};
|
||||
#pragma code_seg(pop, membp_code)
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
Sleep(1000);
|
||||
};
|
||||
#pragma code_seg(pop, membp_code)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue