fixup whitespace
This commit is contained in:
12
configure
vendored
12
configure
vendored
@@ -13,16 +13,16 @@ for arg in $@; do
|
||||
case $arg in
|
||||
--debug)
|
||||
debug="yes"
|
||||
;;
|
||||
;;
|
||||
--release)
|
||||
release="yes"
|
||||
;;
|
||||
;;
|
||||
--coverage)
|
||||
coverage="yes"
|
||||
;;
|
||||
;;
|
||||
--perf)
|
||||
perf="yes"
|
||||
;;
|
||||
;;
|
||||
*)
|
||||
echo "unknown option $arg"
|
||||
exit 1
|
||||
@@ -61,8 +61,8 @@ if [[ "$debug" == "yes" ]]; then
|
||||
fi
|
||||
|
||||
if [[ "$coverage" == "yes" ]]; then
|
||||
ccflags_extra="$ccflags_extra --coverage -fprofile-arcs -ftest-coverage"
|
||||
ldflags_extra="$ldflags_extra -lgcov --coverage"
|
||||
ccflags_extra="$ccflags_extra --coverage -fprofile-arcs -ftest-coverage"
|
||||
ldflags_extra="$ldflags_extra -lgcov --coverage"
|
||||
fi
|
||||
|
||||
release_cflags="-O3 -flto"
|
||||
|
||||
@@ -27,17 +27,15 @@ assert $pc == 10
|
||||
assert $f == 0x2
|
||||
step
|
||||
|
||||
breakpoint add 0xc
|
||||
step 100000
|
||||
breakpoint del 0
|
||||
|
||||
runto 0xc
|
||||
regs
|
||||
assert $pc == 0xc
|
||||
assert $hl == 0x7fff
|
||||
|
||||
# TODO: There is a bug in GBDB where breakpoints fire at the start of an
|
||||
# instruction and "step" stops at the end of an instruction
|
||||
step; step
|
||||
|
||||
regs
|
||||
assert $pc == 0xf
|
||||
assert $hl == 0xff26
|
||||
|
||||
@@ -61,11 +59,8 @@ step
|
||||
assert $pc == 0x16
|
||||
assert $c == 0x12
|
||||
|
||||
|
||||
break add 0x27
|
||||
step 1000
|
||||
runto 0x27
|
||||
assert $pc == 0x27
|
||||
break del 0
|
||||
|
||||
step; step
|
||||
assert $pc == 0x28
|
||||
@@ -102,7 +97,7 @@ assert $pc == 0xa1
|
||||
|
||||
break add 0xa3
|
||||
step 100000
|
||||
break del 0
|
||||
break del 2
|
||||
assert $pc == 0xa3
|
||||
step #FIXME: bugs
|
||||
|
||||
@@ -127,7 +122,7 @@ assert $pc == 0x96
|
||||
break add 0x34
|
||||
step 10000
|
||||
assert $pc == 0x34
|
||||
break del 0
|
||||
break del 3
|
||||
|
||||
step; step
|
||||
assert $pc == 0x37
|
||||
@@ -141,7 +136,7 @@ break add 0x40
|
||||
step 10000
|
||||
assert $pc == 0x40
|
||||
assert $b == 0
|
||||
break del 0
|
||||
break del 4
|
||||
|
||||
step; step
|
||||
assert $pc == 0x42
|
||||
@@ -158,8 +153,15 @@ step
|
||||
assert $pc == 0x4a
|
||||
assert $c == 0x0c
|
||||
|
||||
break add 0x55
|
||||
step 10000
|
||||
assert $pc == 0x55
|
||||
assert $a == 0
|
||||
break del 5
|
||||
|
||||
runto 0x100
|
||||
assert $pc == 0x100
|
||||
echo Test passed!
|
||||
step 10000000
|
||||
regs
|
||||
stat
|
||||
|
||||
|
||||
104
src/apps/gbdb.c
104
src/apps/gbdb.c
@@ -452,48 +452,48 @@ static void do_run(void) {
|
||||
} else if (paused) {
|
||||
gb_log("Interrupted.\n");
|
||||
} else {
|
||||
breakpoint_addr_hit(cpu.pc);
|
||||
gb_log("Breakpoint hit\n");
|
||||
breakpoint_addr_hit(cpu.pc);
|
||||
gb_log("Breakpoint hit\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void run(char *arg_list)
|
||||
{
|
||||
do_run();
|
||||
do_run();
|
||||
}
|
||||
|
||||
static struct breakpoint {
|
||||
uint16_t addr;
|
||||
int id;
|
||||
bool temp;
|
||||
uint16_t addr;
|
||||
int id;
|
||||
bool temp;
|
||||
} breakpoints[MAX_BREAKPTS];
|
||||
|
||||
static int num_breakpoints = 0;
|
||||
|
||||
static struct breakpoint *get_breakpoint(int id)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_breakpoints; i++) {
|
||||
if (breakpoints[i].id == id) {
|
||||
return &breakpoints[i];
|
||||
for (i = 0; i < num_breakpoints; i++) {
|
||||
if (breakpoints[i].id == id) {
|
||||
return &breakpoints[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int do_set_breakpoint(uint16_t addr, bool temp)
|
||||
{
|
||||
static int id = 0;
|
||||
if (num_breakpoints < ARRAY_SIZE(breakpoints)) {
|
||||
breakpoints[num_breakpoints].addr = addr;
|
||||
breakpoints[num_breakpoints].id = id++;
|
||||
breakpoints[num_breakpoints].temp = temp;
|
||||
num_breakpoints++;
|
||||
} else {
|
||||
printf("maximum number of breakpoints reached\n");
|
||||
}
|
||||
static int id = 0;
|
||||
if (num_breakpoints < ARRAY_SIZE(breakpoints)) {
|
||||
breakpoints[num_breakpoints].addr = addr;
|
||||
breakpoints[num_breakpoints].id = id++;
|
||||
breakpoints[num_breakpoints].temp = temp;
|
||||
num_breakpoints++;
|
||||
} else {
|
||||
printf("maximum number of breakpoints reached\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void set_breakpoint(char *arg_string)
|
||||
@@ -512,7 +512,7 @@ static void set_breakpoint(char *arg_string)
|
||||
|
||||
static void runto(char *arg_string)
|
||||
{
|
||||
uint16_t addr, i, rc;
|
||||
uint16_t addr, i, rc;
|
||||
char *token = strtok(arg_string, " ");
|
||||
|
||||
if (token == NULL) {
|
||||
@@ -523,8 +523,8 @@ static void runto(char *arg_string)
|
||||
addr = parse_val(token);
|
||||
rc = do_set_breakpoint(addr, true);
|
||||
if (rc < 0) {
|
||||
printf("failed to set breakpoint\n");
|
||||
return;
|
||||
printf("failed to set breakpoint\n");
|
||||
return;
|
||||
}
|
||||
|
||||
do_run();
|
||||
@@ -532,42 +532,42 @@ static void runto(char *arg_string)
|
||||
|
||||
static int do_delete_breakpoint(int id)
|
||||
{
|
||||
struct breakpoint *bkpt = get_breakpoint(id);
|
||||
int index;
|
||||
struct breakpoint *bkpt = get_breakpoint(id);
|
||||
int index;
|
||||
|
||||
if (bkpt == NULL) {
|
||||
return -1;
|
||||
}
|
||||
if (bkpt == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
index = bkpt - breakpoints;
|
||||
memmove(&breakpoints[index], &breakpoints[index + 1],
|
||||
num_breakpoints - index - 1);
|
||||
num_breakpoints--;
|
||||
index = bkpt - breakpoints;
|
||||
memmove(&breakpoints[index], &breakpoints[index + 1],
|
||||
num_breakpoints - index - 1);
|
||||
num_breakpoints--;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void breakpoint_addr_hit(uint16_t addr)
|
||||
{
|
||||
struct breakpoint *bkpt = NULL;
|
||||
int i;
|
||||
struct breakpoint *bkpt = NULL;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_breakpoints; i++) {
|
||||
if (breakpoints[i].addr == addr) {
|
||||
bkpt= &breakpoints[i];
|
||||
break;
|
||||
for (i = 0; i < num_breakpoints; i++) {
|
||||
if (breakpoints[i].addr == addr) {
|
||||
bkpt= &breakpoints[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (bkpt == NULL) {
|
||||
printf("No breakpoint found at addr=%d\n", addr);
|
||||
return;
|
||||
}
|
||||
if (bkpt == NULL) {
|
||||
printf("No breakpoint found at addr=%d\n", addr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (bkpt->temp) {
|
||||
do_delete_breakpoint(bkpt->id);
|
||||
}
|
||||
if (bkpt->temp) {
|
||||
do_delete_breakpoint(bkpt->id);
|
||||
}
|
||||
}
|
||||
|
||||
static void delete_breakpoint(char *arg_string)
|
||||
@@ -584,7 +584,7 @@ static void delete_breakpoint(char *arg_string)
|
||||
|
||||
rc = do_delete_breakpoint(bkpt);
|
||||
if (rc < 0) {
|
||||
printf("%d is not a valid breakpoint number\n", bkpt);
|
||||
printf("%d is not a valid breakpoint number\n", bkpt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,9 +593,9 @@ static void display_breakpoints(char *arg_string)
|
||||
int i;
|
||||
|
||||
if (num_breakpoints) {
|
||||
for (i = 0; i < num_breakpoints; i++) {
|
||||
printf("#%d: 0x%04x\n", breakpoints[i].id, breakpoints[i].addr);
|
||||
}
|
||||
for (i = 0; i < num_breakpoints; i++) {
|
||||
printf("#%d: 0x%04x\n", breakpoints[i].id, breakpoints[i].addr);
|
||||
}
|
||||
} else {
|
||||
printf("No breakpoints set\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user