1
0
Fork 0

DBG: enum functions for database

This commit is contained in:
Mr. eXoDia 2014-06-25 23:35:24 +02:00
parent dbbff39ef0
commit c168bc7336
2 changed files with 99 additions and 0 deletions

View File

@ -393,6 +393,24 @@ void commentcacheload(JSON root)
} }
} }
bool commentenum(COMMENTSINFO* commentlist, size_t* cbsize)
{
if(!commentlist && !cbsize)
return false;
if(!commentlist && cbsize)
{
*cbsize=comments.size()*sizeof(COMMENTSINFO);
return true;
}
int j=0;
for(CommentsInfo::iterator i=comments.begin(); i!=comments.end(); ++i,j++)
{
commentlist[j]=i->second;
commentlist[j].addr+=modbasefromname(commentlist[j].mod);
}
return true;
}
///label functions ///label functions
bool labelset(uint addr, const char* text, bool manual) bool labelset(uint addr, const char* text, bool manual)
{ {
@ -550,6 +568,24 @@ void labelcacheload(JSON root)
} }
} }
bool labelenum(LABELSINFO* labellist, size_t* cbsize)
{
if(!labellist && !cbsize)
return false;
if(!labellist && cbsize)
{
*cbsize=labels.size()*sizeof(LABELSINFO);
return true;
}
int j=0;
for(LabelsInfo::iterator i=labels.begin(); i!=labels.end(); ++i,j++)
{
labellist[j]=i->second;
labellist[j].addr+=modbasefromname(labellist[j].mod);
}
return true;
}
///bookmark functions ///bookmark functions
bool bookmarkset(uint addr, bool manual) bool bookmarkset(uint addr, bool manual)
{ {
@ -669,6 +705,24 @@ void bookmarkcacheload(JSON root)
} }
} }
bool bookmarkenum(BOOKMARKSINFO* bookmarklist, size_t* cbsize)
{
if(!bookmarklist && !cbsize)
return false;
if(!bookmarklist && cbsize)
{
*cbsize=bookmarks.size()*sizeof(BOOKMARKSINFO);
return true;
}
int j=0;
for(BookmarksInfo::iterator i=bookmarks.begin(); i!=bookmarks.end(); ++i,j++)
{
bookmarklist[j]=i->second;
bookmarklist[j].addr+=modbasefromname(bookmarklist[j].mod);
}
return true;
}
///function database ///function database
bool functionadd(uint start, uint end, bool manual) bool functionadd(uint start, uint end, bool manual)
{ {
@ -815,6 +869,26 @@ void functioncacheload(JSON root)
} }
} }
bool functionenum(FUNCTIONSINFO* functionlist, size_t* cbsize)
{
if(!functionlist && !cbsize)
return false;
if(!functionlist && cbsize)
{
*cbsize=functions.size()*sizeof(FUNCTIONSINFO);
return true;
}
int j=0;
for(FunctionsInfo::iterator i=functions.begin(); i!=functions.end(); ++i,j++)
{
functionlist[j]=i->second;
uint modbase=modbasefromname(functionlist[j].mod);
functionlist[j].start+=modbase;
functionlist[j].end+=modbase;
}
return true;
}
//loop database //loop database
bool loopadd(uint start, uint end, bool manual) bool loopadd(uint start, uint end, bool manual)
{ {
@ -971,4 +1045,24 @@ void loopcacheload(JSON root)
loops.insert(std::make_pair(DepthModuleRange(curLoop.depth, ModuleRange(modhashfromname(curLoop.mod), Range(curLoop.start, curLoop.end))), curLoop)); loops.insert(std::make_pair(DepthModuleRange(curLoop.depth, ModuleRange(modhashfromname(curLoop.mod), Range(curLoop.start, curLoop.end))), curLoop));
} }
} }
}
bool loopenum(LOOPSINFO* looplist, size_t* cbsize)
{
if(!looplist && !cbsize)
return false;
if(!looplist && cbsize)
{
*cbsize=loops.size()*sizeof(LOOPSINFO);
return true;
}
int j=0;
for(LoopsInfo::iterator i=loops.begin(); i!=loops.end(); ++i,j++)
{
looplist[j]=i->second;
uint modbase=modbasefromname(looplist[j].mod);
looplist[j].start+=modbase;
looplist[j].end+=modbase;
}
return true;
} }

View File

@ -133,6 +133,7 @@ bool commentdel(uint addr);
void commentdelrange(uint start, uint end); void commentdelrange(uint start, uint end);
void commentcachesave(JSON root); void commentcachesave(JSON root);
void commentcacheload(JSON root); void commentcacheload(JSON root);
bool commentenum(COMMENTSINFO* commentlist, size_t* cbsize);
bool labelset(uint addr, const char* text, bool manual); bool labelset(uint addr, const char* text, bool manual);
bool labelfromstring(const char* text, uint* addr); bool labelfromstring(const char* text, uint* addr);
@ -141,6 +142,7 @@ bool labeldel(uint addr);
void labeldelrange(uint start, uint end); void labeldelrange(uint start, uint end);
void labelcachesave(JSON root); void labelcachesave(JSON root);
void labelcacheload(JSON root); void labelcacheload(JSON root);
bool labelenum(LABELSINFO* labellist, size_t* cbsize);
bool bookmarkset(uint addr, bool manual); bool bookmarkset(uint addr, bool manual);
bool bookmarkget(uint addr); bool bookmarkget(uint addr);
@ -148,6 +150,7 @@ bool bookmarkdel(uint addr);
void bookmarkdelrange(uint start, uint end); void bookmarkdelrange(uint start, uint end);
void bookmarkcachesave(JSON root); void bookmarkcachesave(JSON root);
void bookmarkcacheload(JSON root); void bookmarkcacheload(JSON root);
bool bookmarkenum(BOOKMARKSINFO* bookmarklist, size_t* cbsize);
bool functionadd(uint start, uint end, bool manual); bool functionadd(uint start, uint end, bool manual);
bool functionget(uint addr, uint* start, uint* end); bool functionget(uint addr, uint* start, uint* end);
@ -156,6 +159,7 @@ bool functiondel(uint addr);
void functiondelrange(uint start, uint end); void functiondelrange(uint start, uint end);
void functioncachesave(JSON root); void functioncachesave(JSON root);
void functioncacheload(JSON root); void functioncacheload(JSON root);
bool functionenum(FUNCTIONSINFO* functionlist, size_t* cbsize);
bool loopadd(uint start, uint end, bool manual); bool loopadd(uint start, uint end, bool manual);
bool loopget(int depth, uint addr, uint* start, uint* end); bool loopget(int depth, uint addr, uint* start, uint* end);
@ -163,5 +167,6 @@ bool loopoverlaps(int depth, uint start, uint end, int* finaldepth);
bool loopdel(int depth, uint addr); bool loopdel(int depth, uint addr);
void loopcachesave(JSON root); void loopcachesave(JSON root);
void loopcacheload(JSON root); void loopcacheload(JSON root);
bool loopenum(LOOPSINFO* looplist, size_t* cbsize);
#endif // _ADDRINFO_H #endif // _ADDRINFO_H