Mercurial > repos > blastem
comparison debug.c @ 2380:1b21290358a8
Fix regression in debugger for Mega CD
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 20 Nov 2023 19:53:00 -0800 |
parents | 1fe5afe263f3 |
children | 9f178feb3cb0 |
comparison
equal
deleted
inserted
replaced
2379:9e6cb50d0639 | 2380:1b21290358a8 |
---|---|
307 return debug_int(0); | 307 return debug_int(0); |
308 } | 308 } |
309 return debug_int(array->size); | 309 return debug_int(array->size); |
310 } | 310 } |
311 | 311 |
312 static debug_root *roots; | 312 static debug_root **roots; |
313 static uint32_t num_roots, root_storage; | 313 static uint32_t num_roots, root_storage; |
314 | 314 |
315 debug_root *find_root(void *cpu) | 315 debug_root *find_root(void *cpu) |
316 { | 316 { |
317 for (uint32_t i = 0; i < num_roots; i++) | 317 for (uint32_t i = 0; i < num_roots; i++) |
318 { | 318 { |
319 if (roots[i].cpu_context == cpu) { | 319 if (roots[i]->cpu_context == cpu) { |
320 return roots + i; | 320 return roots[i]; |
321 } | 321 } |
322 } | 322 } |
323 if (num_roots == root_storage) { | 323 if (num_roots == root_storage) { |
324 root_storage = root_storage ? root_storage * 2 : 5; | 324 root_storage = root_storage ? root_storage * 2 : 5; |
325 roots = realloc(roots, root_storage * sizeof(debug_root)); | 325 roots = realloc(roots, root_storage * sizeof(debug_root*)); |
326 } | 326 } |
327 debug_root *root = roots + num_roots++; | 327 debug_root *root = calloc(1, sizeof(debug_root)); |
328 memset(root, 0, sizeof(debug_root)); | 328 roots[num_roots++] = root; |
329 root->cpu_context = cpu; | 329 root->cpu_context = cpu; |
330 new_readonly_variable(root, "sin", new_native_func(debug_sin, 1, 1)); | 330 new_readonly_variable(root, "sin", new_native_func(debug_sin, 1, 1)); |
331 new_readonly_variable(root, "cos", new_native_func(debug_cos, 1, 1)); | 331 new_readonly_variable(root, "cos", new_native_func(debug_cos, 1, 1)); |
332 new_readonly_variable(root, "tan", new_native_func(debug_tan, 1, 1)); | 332 new_readonly_variable(root, "tan", new_native_func(debug_tan, 1, 1)); |
333 new_readonly_variable(root, "asin", new_native_func(debug_asin, 1, 1)); | 333 new_readonly_variable(root, "asin", new_native_func(debug_asin, 1, 1)); |