Fix another round of suggestions.

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
This commit is contained in:
Ricky Zhang 2017-09-04 14:21:16 -04:00
parent 597ff0666c
commit 93e800ffc7
No known key found for this signature in database
GPG Key ID: 681AFAEF6CDEDB4C
3 changed files with 50 additions and 50 deletions

View File

@ -203,7 +203,7 @@ static __inline__ void m68k_setpc (uaecptr newpc)
#endif
#if ENABLE_MON
if(IS_BREAK_POINT(newpc)) {
if (IS_BREAK_POINT(newpc)) {
printf("Stopped at break point address: %08lx. Last PC: %08lx\n", newpc, previous_pc);
m68k_dumpstate(NULL);
char *arg[4] = {"mon", "-m", "-r", NULL};
@ -220,7 +220,7 @@ static __inline__ void m68k_incpc (uae_s32 delta)
regs.pc_p += (delta);
#if ENABLE_MON
uaecptr next_pc = m68k_getpc();
if(IS_BREAK_POINT(next_pc)) {
if (IS_BREAK_POINT(next_pc)) {
printf("Stopped at break point address: %08lx. Last PC: %08lx\n", next_pc, previous_pc);
m68k_dumpstate(NULL);
char *arg[4] = {"mon", "-m", "-r", NULL};

View File

@ -33,8 +33,8 @@
#endif
static const char* STR_ACTIVE_BREAK_POINTS = "Active Break Points:\n";
static const char* STR_DISABLED_BREAK_POINTS = "Disabled Break Points:\n";
static const char STR_ACTIVE_BREAK_POINTS[] = "Active Break Points:\n";
static const char STR_DISABLED_BREAK_POINTS[] = "Disabled Break Points:\n";
/*
* range_args = [expression] [[COMMA] expression] END
@ -347,7 +347,7 @@ bool validate_index(uintptr *index_ptr, const BREAK_POINT_SET& break_point_set)
}
if (*index_ptr > break_point_set.size()) {
mon_error("Illegal Index Number!");
mon_error("Illegal index number!");
return false;
}
@ -418,8 +418,7 @@ void break_point_enable(void)
return;
if (0 == index) {
for (BREAK_POINT_SET::iterator it = disabled_break_points.begin(); it != disabled_break_points.end(); it++)
active_break_points.insert(*it);
active_break_points.insert(disabled_break_points.begin(), disabled_break_points.end());
disabled_break_points.clear();
printf("Enabled all break points!\n");
return;
@ -469,8 +468,6 @@ void break_point_info(void)
*/
void break_point_save(void)
{
FILE *file;
if (mon_token == T_END) {
mon_error("Missing file name");
return;
@ -485,21 +482,23 @@ void break_point_save(void)
return;
}
if (!(file = fopen(mon_string, "w")))
FILE *file;
if (!(file = fopen(mon_string, "w"))) {
mon_error("Unable to create file");
else {
BREAK_POINT_SET::iterator it;
return;
}
fprintf(file, STR_ACTIVE_BREAK_POINTS);
for (it = active_break_points.begin(); it != active_break_points.end(); it++)
BREAK_POINT_SET::iterator it;
fprintf(file, STR_ACTIVE_BREAK_POINTS);
for (it = active_break_points.begin(); it != active_break_points.end(); it++)
fprintf(file, "%x\n", *it);
fprintf(file, STR_DISABLED_BREAK_POINTS);
for (it = disabled_break_points.begin(); it != disabled_break_points.end(); it++)
fprintf(file, "%x\n", *it);
fprintf(file, STR_DISABLED_BREAK_POINTS);
for (it = disabled_break_points.begin(); it != disabled_break_points.end(); it++)
fprintf(file, "%x\n", *it);
fclose(file);
}
fclose(file);
}
@ -508,8 +507,6 @@ void break_point_save(void)
*/
void break_point_load(void)
{
FILE *file;
if (mon_token == T_END) {
mon_error("Missing file name");
return;
@ -524,35 +521,38 @@ void break_point_load(void)
return;
}
if (!(file = fopen(mon_string, "r")))
FILE *file;
if (!(file = fopen(mon_string, "r"))) {
mon_error("Unable to create file");
else {
char line_buff[1024];
bool is_disabled_break_points = false;;
if(fgets(line_buff, sizeof(line_buff), file) == NULL ||
strcmp(line_buff, STR_ACTIVE_BREAK_POINTS) != 0) {
mon_error("Invalid break point file format!");
return;
}
while(fgets(line_buff, sizeof(line_buff), file) != NULL) {
if(strcmp(line_buff, STR_DISABLED_BREAK_POINTS) == 0) {
is_disabled_break_points = true;
continue;
}
uintptr address;
std::stringstream ss;
ss << std::hex << line_buff;
ss >> address;
if(is_disabled_break_points)
disabled_break_points.insert(address);
else
active_break_points.insert(address);
}
fclose(file);
return;
}
char line_buff[1024];
bool is_disabled_break_points = false;;
if (fgets(line_buff, sizeof(line_buff), file) == NULL ||
strcmp(line_buff, STR_ACTIVE_BREAK_POINTS) != 0) {
mon_error("Invalid break point file format!");
fclose(file);
return;
}
while (fgets(line_buff, sizeof(line_buff), file) != NULL) {
if (strcmp(line_buff, STR_DISABLED_BREAK_POINTS) == 0) {
is_disabled_break_points = true;
continue;
}
uintptr address;
std::stringstream ss;
ss << std::hex << line_buff;
ss >> address;
if (is_disabled_break_points)
disabled_break_points.insert(address);
else
active_break_points.insert(address);
}
fclose(file);
}

View File

@ -1,5 +1,5 @@
# What
suspend.bin is a MacBinary file which should be upacked and run in M68k Macintosh only. It runs emul_op `0x7138` and trigger BasiliskII into cxmon so that you can add break points there.
suspend.bin is a MacBinary file which should be unpacked and run in M68k Macintosh only. It runs emul_op `0x7138` and trigger BasiliskII into cxmon so that you can add break points there.
# How
1. You must build Basilisk II `--with-mon=YES` options.