diff options
author | Michael Neuling <mikey@neuling.org> | 2018-06-19 15:25:33 +1000 |
---|---|---|
committer | Alistair Popple <alistair@popple.id.au> | 2018-06-25 15:11:03 +1000 |
commit | 6ac2a7b441a0aa5ac4d6123c16a18338631a8a01 (patch) | |
tree | dbdffe8fac1872d247644508288bfe957ce709b3 /src/htm.c | |
parent | 2b861e33872327a313eda28c9bb3ebb809e36408 (diff) | |
download | pdbg-6ac2a7b441a0aa5ac4d6123c16a18338631a8a01.tar.gz pdbg-6ac2a7b441a0aa5ac4d6123c16a18338631a8a01.zip |
htm: Add record command
This starts the trace, waits for it to complete (ie fill the buffer),
then stops the trace and dumps out the file.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Diffstat (limited to 'src/htm.c')
-rw-r--r-- | src/htm.c | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -177,6 +177,37 @@ static int run_dump(enum htm_type type) return rc; } +static int run_record(enum htm_type type) +{ + struct pdbg_target *target; + char *filename; + int rc = 0; + + pdbg_for_each_class_target(HTM_ENUM_TO_STRING(type), target) { + if (!target_selected(target)) + continue; + pdbg_target_probe(target); + if (target_is_disabled(target)) + continue; + + filename = get_htm_dump_filename(target); + if (!filename) + return 0; + + /* size = 0 will dump everything */ + printf("Recording HTM@"); + print_htm_address(type, target); + if (htm_record(target, filename) != 1) { + printf("Couldn't record HTM@"); + print_htm_address(type, target); + } + rc++; + free(filename); + } + + return rc; +} + static struct { const char *name; const char *args; @@ -187,6 +218,7 @@ static struct { { "stop", "", "Stop %s HTM", &run_stop }, { "status", "", "Get %s HTM status", &run_status }, { "dump", "", "Dump %s HTM buffer to file", &run_dump }, + { "record", "", "Start, wait & dump %s HTM", &run_record }, }; static void print_usage(enum htm_type type) |