Mercurial > repos > blastem
comparison debug.c @ 2133:8554751f17b5
Remove use of get_native_pointer in 68K instruction decoding in preparation for word RAM interleaving
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 17 Mar 2022 22:41:42 -0700 |
parents | 3abb64bd0da6 |
children | cb9572145f8e |
comparison
equal
deleted
inserted
replaced
2132:7451f970ee66 | 2133:8554751f17b5 |
---|---|
783 } | 783 } |
784 break; | 784 break; |
785 case 'b': | 785 case 'b': |
786 if (input_buf[1] == 't') { | 786 if (input_buf[1] == 't') { |
787 uint32_t stack = context->aregs[7]; | 787 uint32_t stack = context->aregs[7]; |
788 if (stack >= 0xE00000) { | 788 uint8_t non_adr_count = 0; |
789 stack &= 0xFFFF; | 789 do { |
790 uint8_t non_adr_count = 0; | 790 uint32_t bt_address = m68k_instruction_fetch(stack, context); |
791 do { | 791 bt_address = get_instruction_start(context->options, bt_address - 2); |
792 uint32_t bt_address = system->work_ram[stack/2] << 16 | system->work_ram[stack/2+1]; | 792 if (bt_address) { |
793 bt_address = get_instruction_start(context->options, bt_address - 2); | 793 stack += 4; |
794 if (bt_address) { | 794 non_adr_count = 0; |
795 stack += 4; | 795 m68k_decode(m68k_instruction_fetch, context, &inst, bt_address); |
796 non_adr_count = 0; | 796 m68k_disasm(&inst, input_buf); |
797 uint16_t *bt_pc = NULL; | 797 printf("%X: %s\n", bt_address, input_buf); |
798 if (bt_address < 0x400000) { | 798 } else { |
799 bt_pc = system->cart + bt_address/2; | 799 //non-return address value on stack can be word wide |
800 } else if(bt_address > 0xE00000) { | 800 stack += 2; |
801 bt_pc = system->work_ram + (bt_address & 0xFFFF)/2; | 801 non_adr_count++; |
802 } | 802 } |
803 m68k_decode(bt_pc, &inst, bt_address); | 803 //TODO: Make sure we don't wander into an invalid memory region |
804 m68k_disasm(&inst, input_buf); | 804 } while (stack && non_adr_count < 6); |
805 printf("%X: %s\n", bt_address, input_buf); | |
806 } else { | |
807 //non-return address value on stack can be word wide | |
808 stack += 2; | |
809 non_adr_count++; | |
810 } | |
811 stack &= 0xFFFF; | |
812 } while (stack && non_adr_count < 6); | |
813 } | |
814 } else { | 805 } else { |
815 param = find_param(input_buf); | 806 param = find_param(input_buf); |
816 if (!param) { | 807 if (!param) { |
817 fputs("b command requires a parameter\n", stderr); | 808 fputs("b command requires a parameter\n", stderr); |
818 break; | 809 break; |
1124 remove_breakpoint(context, root->branch_t); | 1115 remove_breakpoint(context, root->branch_t); |
1125 } | 1116 } |
1126 root->branch_t = root->branch_f = 0; | 1117 root->branch_t = root->branch_f = 0; |
1127 } | 1118 } |
1128 | 1119 |
1129 uint16_t * pc = get_native_pointer(address, (void **)context->mem_pointers, &context->options->gen); | 1120 uint32_t after = m68k_decode(m68k_instruction_fetch, context, &inst, address); |
1130 if (!pc) { | |
1131 fatal_error("Entered 68K debugger at address %X\n", address); | |
1132 } | |
1133 uint16_t * after_pc = m68k_decode(pc, &inst, address); | |
1134 uint32_t after = address + (after_pc-pc)*2; | |
1135 int debugging = 1; | 1121 int debugging = 1; |
1136 //Check if this is a user set breakpoint, or just a temporary one | 1122 //Check if this is a user set breakpoint, or just a temporary one |
1137 bp_def ** this_bp = find_breakpoint(&root->breakpoints, address); | 1123 bp_def ** this_bp = find_breakpoint(&root->breakpoints, address); |
1138 if (*this_bp) { | 1124 if (*this_bp) { |
1139 | 1125 |