From e6148ddb139eaac826c73c19ff29d9f8b2255d0f Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sat, 30 Aug 2014 04:00:17 -0700 Subject: [PATCH] Add p/t to CLI debugger --- src/debugger/cli-debugger.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/debugger/cli-debugger.c b/src/debugger/cli-debugger.c index 00ce690e2..27b8bcc2a 100644 --- a/src/debugger/cli-debugger.c +++ b/src/debugger/cli-debugger.c @@ -34,6 +34,7 @@ static void _disassembleArm(struct CLIDebugger*, struct DebugVector*); static void _disassembleThumb(struct CLIDebugger*, struct DebugVector*); static void _next(struct CLIDebugger*, struct DebugVector*); static void _print(struct CLIDebugger*, struct DebugVector*); +static void _printBin(struct CLIDebugger*, struct DebugVector*); static void _printHex(struct CLIDebugger*, struct DebugVector*); static void _printStatus(struct CLIDebugger*, struct DebugVector*); static void _quit(struct CLIDebugger*, struct DebugVector*); @@ -69,8 +70,10 @@ static struct { { "n", _next }, { "next", _next }, { "p", _print }, + { "p/t", _printBin }, { "p/x", _printHex }, { "print", _print }, + { "print/t", _printBin }, { "print/x", _printHex }, { "q", _quit }, { "quit", _quit }, @@ -180,6 +183,18 @@ static void _print(struct CLIDebugger* debugger, struct DebugVector* dv) { printf("\n"); } +static void _printBin(struct CLIDebugger* debugger, struct DebugVector* dv) { + UNUSED(debugger); + for ( ; dv; dv = dv->next) { + printf(" 0b"); + int i = 32; + while (i--) { + printf("%u", (dv->intValue >> i) & 1); + } + } + printf("\n"); +} + static void _printHex(struct CLIDebugger* debugger, struct DebugVector* dv) { UNUSED(debugger); for ( ; dv; dv = dv->next) {