Skip to content
This repository has been archived by the owner on Jun 27, 2018. It is now read-only.

Commit

Permalink
Added -n option to debugger to not attach default devices (used in te…
Browse files Browse the repository at this point in the history
…st suite).
  • Loading branch information
hach-que committed Jun 17, 2012
1 parent 6aed07c commit c7d6191
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
12 changes: 9 additions & 3 deletions dtdb/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ int main(int argc, char** argv)
struct arg_file* symbols_file = arg_file0("s", "symbols", "<file>", "The file to load symbols from.");
struct arg_file* input_file = arg_file0(NULL, NULL, "<file>", "The file to initially load.");
struct arg_lit* little_endian_mode = arg_lit0(NULL, "little-endian", "Use little endian serialization (for compatibility with older versions).");
struct arg_lit* no_attach_mode = arg_lit0("n", "no-attachment", "Do not attach default devices when launched.");
struct arg_lit* verbose = arg_litn("v", NULL, 0, LEVEL_EVERYTHING - LEVEL_DEFAULT, "Increase verbosity.");
struct arg_lit* quiet = arg_litn("q", NULL, 0, LEVEL_DEFAULT - LEVEL_SILENT, "Decrease verbosity.");
struct arg_end* end = arg_end(20);
void* argtable[] = { show_help, command_arg, symbols_file, input_file, little_endian_mode, verbose, quiet, end };
void* argtable[] = { show_help, no_attach_mode, command_arg, symbols_file, input_file, little_endian_mode, verbose, quiet, end };

// Parse arguments.
nerrors = arg_parse(argc, argv, argtable);
Expand Down Expand Up @@ -115,12 +116,17 @@ int main(int argc, char** argv)
// Initialize debugger.
ddbg_init();

// Load file if filename is specified.
if (input_file->count > 0)
// Initialize devices unless not requested.
if (no_attach_mode->count == 0)
{
ddbg_attach(bfromcstr("clock"));
ddbg_attach(bfromcstr("keyboard"));
ddbg_attach(bfromcstr("lem1802"));
}

// Load file if filename is specified.
if (input_file->count > 0)
{
ddbg_load(bfromcstr(input_file->filename[0]));
ddbg_flash_vm();
}
Expand Down
3 changes: 3 additions & 0 deletions tests/data/asm/crash-paramcount.i
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ SET
SET A
SET A, B
SET A, B, C
RFI
RFI A
RFI A, B

; This file should fail to compile, but not crash
3 changes: 3 additions & 0 deletions tests/drivers/testvm/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ int main(int argc, char* argv[])
bconchar(cmdargs, '"');
bconchar(cmdargs, ' ');

// Do not attach devices during testing.
bcatcstr(cmdargs, "-n ");

// Run the 'test' command automatically.
bcatcstr(cmdargs, "-c test ");

Expand Down

0 comments on commit c7d6191

Please sign in to comment.