1
0
Fork 0

DBG: add dbdecompress helper command

This commit is contained in:
Duncan Ogilvie 2020-06-03 10:07:43 +02:00
parent 430ea53876
commit 6293b90aff
3 changed files with 22 additions and 1 deletions

View File

@ -501,4 +501,23 @@ bool cbInstrAnimateWait(int argc, char* argv[])
Sleep(1);
}
return true;
}
#include <lz4/lz4file.h>
bool cbInstrDbdecompress(int argc, char* argv[])
{
if(argc < 2)
{
dprintf_untranslated("Usage: dbdecompress \"c:\\path\\to\\db\"\n");
return false;
}
auto dbFile = StringUtils::Utf8ToUtf16(argv[1]);
if(LZ4_decompress_fileW(dbFile.c_str(), dbFile.c_str()) != LZ4_SUCCESS)
{
dprintf_untranslated("Failed to decompress '%s'\n", argv[1]);
return false;
}
dprintf_untranslated("Decompressed '%s'\n", argv[1]);
return true;
}

View File

@ -13,4 +13,5 @@ bool cbInstrMeminfo(int argc, char* argv[]);
bool cbInstrBriefcheck(int argc, char* argv[]);
bool cbInstrFocusinfo(int argc, char* argv[]);
bool cbInstrFlushlog(int argc, char* argv[]);
bool cbInstrAnimateWait(int argc, char* argv[]);
bool cbInstrAnimateWait(int argc, char* argv[]);
bool cbInstrDbdecompress(int argc, char* argv[]);

View File

@ -442,6 +442,7 @@ static void registercommands()
dbgcmdnew("printstack,logstack", cbInstrPrintStack, true); //print the call stack
dbgcmdnew("flushlog", cbInstrFlushlog, false); //flush the log
dbgcmdnew("AnimateWait", cbInstrAnimateWait, true); //Wait for the debuggee to pause.
dbgcmdnew("dbdecompress", cbInstrDbdecompress, false); //Decompress a database.
};
bool cbCommandProvider(char* cmd, int maxlen)