Added debugging option --disable-random-id.

This commit is contained in:
Markus F.X.J. Oberhumer 2006-11-21 18:17:51 +01:00
parent 5d71e69941
commit 2569b09dbe
3 changed files with 10 additions and 0 deletions

View File

@ -603,6 +603,9 @@ static int do_option(int optc, const char *arg)
e_optarg(arg);
opt->debug.dump_stub_loader = mfx_optarg;
break;
case 545:
opt->debug.disable_random_id = true;
break;
// misc
case 512:
@ -888,6 +891,7 @@ static const struct mfx_option longopts[] =
{"dump-stub-loader" ,0x31, 0, 544}, // for internal debugging
{"fake-stub-version",0x31, 0, 542}, // for internal debugging
{"fake-stub-year" ,0x31, 0, 543}, // for internal debugging
{"disable-random-id",0x10, 0, 545}, // for internal debugging
// backup options
{"backup", 0x10, 0, 'k'},
@ -1032,6 +1036,9 @@ static const struct mfx_option longopts[] =
{"silent", 0, 0, 'q'}, // quiet mode
{"verbose", 0, 0, 'v'}, // verbose mode
// debug options
{"disable-random-id",0x10, 0, 545}, // for internal debugging
// backup options
{"backup", 0x10, 0, 'k'},
{"keep", 0x10, 0, 'k'},

View File

@ -71,6 +71,7 @@ struct options_t {
// debug options
struct {
int debug_level;
bool disable_random_id; // for Packer::getRandomId()
const char *dump_stub_loader;
char fake_stub_version[4+1]; // for internal debugging
char fake_stub_year[4+1]; // for internal debugging

View File

@ -575,6 +575,8 @@ void Packer::copyOverlay(OutputFile *fo, unsigned overlay,
// Create a pseudo-unique program id.
unsigned Packer::getRandomId() const
{
if (opt->debug.disable_random_id)
return 0x01020304;
unsigned id = 0;
#if 0 && defined(__unix__)
// Don't consume precious bytes from /dev/urandom.