1
0
Fork 0

DBG: fixed a huge memory leak with dbghelp

GUI: fixed a memory leak inside BreakpointsView
This commit is contained in:
mr.exodia 2014-02-18 19:48:27 +01:00
parent f016eb8a6e
commit 4a145fbcff
4 changed files with 7 additions and 18 deletions

View File

@ -124,7 +124,7 @@ enum SCRIPTLINETYPE
};
//Debugger typedefs
typedef struct SYMBOLINFO;
struct SYMBOLINFO;
typedef void (*CBSYMBOLENUM)(SYMBOLINFO* symbol, void* user);

View File

@ -440,6 +440,8 @@ static void cbExitProcess(EXIT_PROCESS_DEBUG_INFO* ExitProcess)
PLUG_CB_EXITPROCESS callbackInfo;
callbackInfo.ExitProcess=ExitProcess;
plugincbcall(CB_EXITPROCESS, &callbackInfo);
//Cleanup
SymCleanup(fdProcessInfo->hProcess);
}
static void cbCreateThread(CREATE_THREAD_DEBUG_INFO* CreateThread)
@ -671,7 +673,7 @@ static DWORD WINAPI threadDebugLoop(void* lpParameter)
//message the user/do final stuff
DeleteFileA("DLLLoader.exe");
RemoveAllBreakPoints(UE_OPTION_REMOVEALL); //remove all breakpoints
SymCleanup(fdProcessInfo->hProcess);
//cleanup
dbclose();
modclear();
GuiSetDebugState(stopped);
@ -1603,7 +1605,6 @@ static DWORD WINAPI threadAttachLoop(void* lpParameter)
//message the user/do final stuff
DeleteFileA("DLLLoader.exe");
RemoveAllBreakPoints(UE_OPTION_REMOVEALL); //remove all breakpoints
SymCleanup(fdProcessInfo->hProcess);
dbclose();
modclear();
GuiSetDebugState(stopped);

View File

@ -47,15 +47,6 @@ SymbolView::SymbolView(QWidget *parent) :
ui->mainSplitter->setStretchFactor(0, 9);
ui->mainSplitter->setStretchFactor(1, 2);
/*mModuleList->setRowCount(5);
const char* modules[5]={"ntdll.dll", "kernel32.dll", "kernelbase.dll", "msvcrt.dll", "user32.dll"};
const char* bases[5]={"77A70000", "773D0000", "762F0000", "75800000", "756F0000"};
for(int i=0; i<5; i++)
{
mModuleList->setCellContent(i, 0, bases[i]);
mModuleList->setCellContent(i, 1, modules[i]);
}*/
connect(Bridge::getBridge(), SIGNAL(addMsgToSymbolLog(QString)), this, SLOT(addMsgToSymbolLogSlot(QString)));
connect(Bridge::getBridge(), SIGNAL(clearLog()), this, SLOT(clearSymbolLogSlot()));
connect(Bridge::getBridge(), SIGNAL(clearSymbolLog()), this, SLOT(clearSymbolLogSlot()));

View File

@ -65,7 +65,6 @@ void BreakpointsView::reloadData()
// Hardware
DbgGetBpList(bp_hardware, &wBPList);
mHardBPTable->setRowCount(wBPList.count);
for(wI = 0; wI < wBPList.count; wI++)
{
QString addr_text=QString("%1").arg(wBPList.bp[wI].addr, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
@ -91,13 +90,12 @@ void BreakpointsView::reloadData()
if(DbgGetCommentAt(wBPList.bp[wI].addr, comment))
mSoftBPTable->setCellContent(wI, 4, comment);
}
mHardBPTable->reloadData();
BridgeFree(wBPList.bp);
// Software
DbgGetBpList(bp_normal, &wBPList);
mSoftBPTable->setRowCount(wBPList.count);
for(wI = 0; wI < wBPList.count; wI++)
{
QString addr_text=QString("%1").arg(wBPList.bp[wI].addr, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
@ -123,13 +121,12 @@ void BreakpointsView::reloadData()
if(DbgGetCommentAt(wBPList.bp[wI].addr, comment))
mSoftBPTable->setCellContent(wI, 4, comment);
}
mSoftBPTable->reloadData();
BridgeFree(wBPList.bp);
// Memory
DbgGetBpList(bp_memory, &wBPList);
mMemBPTable->setRowCount(wBPList.count);
for(wI = 0; wI < wBPList.count; wI++)
{
QString addr_text=QString("%1").arg(wBPList.bp[wI].addr, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
@ -155,8 +152,8 @@ void BreakpointsView::reloadData()
if(DbgGetCommentAt(wBPList.bp[wI].addr, comment))
mSoftBPTable->setCellContent(wI, 4, comment);
}
mMemBPTable->reloadData();
BridgeFree(wBPList.bp);
}