1
0
Fork 0

GUI: fixed a compile problem

DBG: formatting
This commit is contained in:
Mr. eXoDia 2014-08-05 01:21:17 +02:00
parent 7aa4d19fe1
commit fa1377be12
5 changed files with 74 additions and 73 deletions

View File

@ -110,12 +110,12 @@ static void _getcallstack(DBGCALLSTACK* callstack)
static bool _getjit(char* jit, bool jit64)
{
arch dummy;
char * jit_tmp;
char* jit_tmp;
if(!dbggetjit(&jit_tmp, jit64 ? x64 : x32, &dummy))
return false;
//get out the actual jit path
strcpy( jit, jit_tmp );
strcpy(jit, jit_tmp);
efree(jit_tmp);
@ -144,6 +144,6 @@ void dbgfunctionsinit()
_dbgfunctions.MemUpdateMap = memupdatemap;
_dbgfunctions.GetCallStack = _getcallstack;
_dbgfunctions.SymbolDownloadAllSymbols = symdownloadallsymbols;
_dbgfunctions.GetJit=_getjit;
_dbgfunctions.GetDefJit=dbggetdefjit;
_dbgfunctions.GetJit = _getjit;
_dbgfunctions.GetDefJit = dbggetdefjit;
}

View File

@ -1484,9 +1484,9 @@ bool dbggetjit(char** jit_entry_out, arch arch_in, arch* arch_out)
DWORD lRv;
HKEY hKey;
if (arch_out != NULL )
if(arch_out != NULL)
{
if ( arch_in != x64 && arch_in != x32 )
if(arch_in != x64 && arch_in != x32)
{
#ifdef _WIN32
* arch_out = x32;
@ -1499,46 +1499,46 @@ bool dbggetjit(char** jit_entry_out, arch arch_in, arch* arch_out)
* arch_out = arch_in;
}
if ( arch_in == x64 )
if(arch_in == x64)
{
if (!IsWow64())
if(!IsWow64())
return false;
#ifdef _WIN32
key_flags |= KEY_WOW64_64KEY;
#endif
}
else if ( arch_in == x32 )
else if(arch_in == x32)
{
#ifdef _WIN64
key_flags |= KEY_WOW64_32KEY;
#endif
}
lRv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, JIT_REG_KEY, 0, key_flags,&hKey);
if (lRv != ERROR_SUCCESS)
lRv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, JIT_REG_KEY, 0, key_flags, &hKey);
if(lRv != ERROR_SUCCESS)
return false;
char jit_entry[512];
DWORD jit_entry_size = sizeof( jit_entry );
DWORD jit_entry_size = sizeof(jit_entry);
lRv = RegQueryValueExA(hKey, "Debugger", 0, NULL, (LPBYTE)jit_entry, & jit_entry_size);
if (lRv != ERROR_SUCCESS)
if(lRv != ERROR_SUCCESS)
return false;
* jit_entry_out = (char *) emalloc( jit_entry_size, "dbggetjit:*jit_entry_out");
* jit_entry_out = (char*) emalloc(jit_entry_size, "dbggetjit:*jit_entry_out");
strcpy( * jit_entry_out, jit_entry );
strcpy(* jit_entry_out, jit_entry);
return true;
}
bool dbggetdefjit(char * jit_entry)
bool dbggetdefjit(char* jit_entry)
{
char path[JIT_ENTRY_DEF_SIZE];
path[0] = '"';
GetModuleFileNameA(GetModuleHandleA(NULL), &path[1], MAX_PATH);
strcat(path, ATTACH_CMD_LINE);
strcpy( jit_entry, path );
strcpy(jit_entry, path);
return true;
}
@ -1550,9 +1550,9 @@ bool dbgsetjit(char* jit_cmd, arch arch_in, arch* arch_out)
HKEY hKey;
DWORD dwDisposition;
if (arch_out != NULL )
if(arch_out != NULL)
{
if ( arch_in != x64 && arch_in != x32 )
if(arch_in != x64 && arch_in != x32)
{
#ifdef _WIN32
* arch_out = x32;
@ -1565,15 +1565,15 @@ bool dbgsetjit(char* jit_cmd, arch arch_in, arch* arch_out)
* arch_out = arch_in;
}
if ( arch_in == x64 )
if(arch_in == x64)
{
if (!IsWow64())
if(!IsWow64())
return false;
#ifdef _WIN32
key_flags |= KEY_WOW64_64KEY;
#endif
}
else if ( arch_in == x32 )
else if(arch_in == x32)
{
#ifdef _WIN64
key_flags |= KEY_WOW64_32KEY;
@ -1581,10 +1581,10 @@ bool dbgsetjit(char* jit_cmd, arch arch_in, arch* arch_out)
}
lRv = RegCreateKeyEx(HKEY_LOCAL_MACHINE, JIT_REG_KEY, 0, NULL, REG_OPTION_NON_VOLATILE, key_flags, NULL, &hKey, &dwDisposition);
if (lRv != ERROR_SUCCESS)
if(lRv != ERROR_SUCCESS)
return false;
lRv = RegSetValueExA(hKey, "Debugger", 0, REG_SZ, (BYTE *) jit_cmd, strlen(jit_cmd) + 1 );
lRv = RegSetValueExA(hKey, "Debugger", 0, REG_SZ, (BYTE*) jit_cmd, (DWORD)strlen(jit_cmd) + 1);
RegCloseKey(hKey);
return (lRv == ERROR_SUCCESS);

View File

@ -53,7 +53,7 @@ bool dbgcmdnew(const char* name, CBCOMMAND cbCommand, bool debugonly);
bool dbgcmddel(const char* name);
bool dbggetjit(char** jit_entry_out, arch arch_in, arch* arch_out);
bool dbgsetjit(char* jit_cmd, arch arch_in, arch* arch_out);
bool dbggetdefjit(char *);
bool dbggetdefjit(char* jit_entry);
void cbStep();
void cbRtrStep();

View File

@ -1397,109 +1397,109 @@ CMDRESULT cbDebugDownloadSymbol(int argc, char* argv[])
CMDRESULT cbDebugSetJIT(int argc, char* argv[])
{
arch actual_arch;
char * jit_debugger_cmd;
char* jit_debugger_cmd;
if(argc < 2)
{
char path[JIT_ENTRY_DEF_SIZE];
dbggetdefjit(path);
jit_debugger_cmd = path;
if (!dbgsetjit( jit_debugger_cmd, notfound, & actual_arch ))
if(!dbgsetjit(jit_debugger_cmd, notfound, & actual_arch))
{
dprintf( "Error setting JIT %s\n", (actual_arch == x64) ? "x64" : "x32" );
dprintf("Error setting JIT %s\n", (actual_arch == x64) ? "x64" : "x32");
return STATUS_ERROR;
}
}
else if ( argc == 2 )
else if(argc == 2)
{
jit_debugger_cmd = argv[1];
if (!dbgsetjit( jit_debugger_cmd, notfound, & actual_arch ))
if(!dbgsetjit(jit_debugger_cmd, notfound, & actual_arch))
{
dprintf( "Error setting JIT %s\n", (actual_arch == x64) ? "x64" : "x32" );
dprintf("Error setting JIT %s\n", (actual_arch == x64) ? "x64" : "x32");
return STATUS_ERROR;
}
}
else if ( argc == 3 )
else if(argc == 3)
{
actual_arch = x64;
if ( _strcmpi( argv[1], "x64" ) == 0 )
if(_strcmpi(argv[1], "x64") == 0)
{
if (!IsWow64())
if(!IsWow64())
{
dprintf( "Error using x64 arg the debugger is not a WOW64 process", (actual_arch == x64) ? "x64" : "x32" );
dprintf("Error using x64 arg the debugger is not a WOW64 process", (actual_arch == x64) ? "x64" : "x32");
return STATUS_ERROR;
}
}
else if ( _strcmpi( argv[1], "x32" ) == 0 )
else if(_strcmpi(argv[1], "x32") == 0)
actual_arch = x32;
else
{
dputs( "Unkown jit entry type use x64 or x32 parameter");
dputs("Unkown jit entry type use x64 or x32 parameter");
return STATUS_ERROR;
}
jit_debugger_cmd = argv[2];
if (!dbgsetjit( jit_debugger_cmd, actual_arch, NULL))
if(!dbgsetjit(jit_debugger_cmd, actual_arch, NULL))
{
dprintf( "Error getting JIT %s\n", (actual_arch == x64) ? "x64" : "x32" );
dprintf("Error getting JIT %s\n", (actual_arch == x64) ? "x64" : "x32");
return STATUS_ERROR;
}
}
else
{
dputs( "Error unkown parameters use x86 or x64, cmdline" );
dputs("Error unkown parameters use x86 or x64, cmdline");
return STATUS_ERROR;
}
dprintf( " New JIT %s: %s\n", (actual_arch == x64) ? "x64" : "x32", jit_debugger_cmd );
dprintf(" New JIT %s: %s\n", (actual_arch == x64) ? "x64" : "x32", jit_debugger_cmd);
return STATUS_CONTINUE;
}
CMDRESULT cbDebugGetJIT(int argc, char* argv[])
{
char * get_entry = NULL;
char* get_entry = NULL;
arch actual_arch;
if(argc < 2)
{
if (!dbggetjit( & get_entry, notfound, & actual_arch ))
if(!dbggetjit(& get_entry, notfound, & actual_arch))
{
dprintf( "Error getting JIT %s\n", (actual_arch == x64) ? "x64" : "x32" );
dprintf("Error getting JIT %s\n", (actual_arch == x64) ? "x64" : "x32");
return STATUS_ERROR;
}
}
else
{
if ( _strcmpi( argv[1], "x64" ) == 0 )
if(_strcmpi(argv[1], "x64") == 0)
{
actual_arch = x64;
if (!IsWow64())
if(!IsWow64())
{
dprintf( "Error using x64 arg the debugger is not a WOW64 process", (actual_arch == x64) ? "x64" : "x32" );
dprintf("Error using x64 arg the debugger is not a WOW64 process", (actual_arch == x64) ? "x64" : "x32");
return STATUS_ERROR;
}
}
else if ( _strcmpi( argv[1], "x32" ) == 0 )
else if(_strcmpi(argv[1], "x32") == 0)
actual_arch = x32;
else
{
dputs( "Unkown jit entry type use x64 or x32 parameter");
dputs("Unkown jit entry type use x64 or x32 parameter");
return STATUS_ERROR;
}
if (!dbggetjit( & get_entry, actual_arch, NULL ))
if(!dbggetjit(& get_entry, actual_arch, NULL))
{
dprintf( "Error getting JIT %s\n", argv[1] );
dprintf("Error getting JIT %s\n", argv[1]);
return STATUS_ERROR;
}
}
dprintf( " JIT %s: %s\n", (actual_arch == x64) ? "x64" : "x32", get_entry );
if ( get_entry != NULL )
dprintf(" JIT %s: %s\n", (actual_arch == x64) ? "x64" : "x32", get_entry);
if(get_entry != NULL)
efree(get_entry);
return STATUS_CONTINUE;
}

View File

@ -162,27 +162,28 @@ void SettingsDialog::LoadSettings()
GetSettingBool("Misc", "SetJIT", &settings.eventSetJIT);
ui->chkSetJIT->setCheckState(bool2check(settings.eventSetJIT));
if ( DbgFunctions()->GetJit != NULL )
if(DbgFunctions()->GetJit != NULL)
{
char jit_entry[MAX_SETTING_SIZE]="";
char jit_def_entry[MAX_SETTING_SIZE]="";
bool isx64=true;
#ifndef _WIN64
isx64=false;
#endif
if(DbgFunctions()->GetJit)
{
DbgFunctions()->GetJit(jit_entry, isx64);
DbgFunctions()->GetDefJit(jit_def_entry);
char jit_entry[MAX_SETTING_SIZE] = "";
char jit_def_entry[MAX_SETTING_SIZE] = "";
bool isx64 = true;
#ifndef _WIN64
isx64 = false;
#endif
if(DbgFunctions()->GetJit)
{
DbgFunctions()->GetJit(jit_entry, isx64);
DbgFunctions()->GetDefJit(jit_def_entry);
if (_strcmpi(jit_entry, jit_def_entry) == 0)
settings.eventSetJIT=true;
else
settings.eventSetJIT=false;
if(_strcmpi(jit_entry, jit_def_entry) == 0)
settings.eventSetJIT = true;
else
settings.eventSetJIT = false;
ui->editJIT->setText(jit_entry);
ui->editJIT->setText(jit_entry);
ui->chkSetJIT->setCheckState(bool2check(settings.eventSetJIT));
ui->chkSetJIT->setCheckState(bool2check(settings.eventSetJIT));
}
}
}
@ -228,7 +229,7 @@ void SettingsDialog::SaveSettings()
Config()->load();
DbgSettingsUpdated();
GuiUpdateAllViews();
GuiUpdateAllViews();
}
void SettingsDialog::AddRangeToList(RangeStruct range)