Changeset 7cc6ac0 in buchla-emu for emu/main.c


Ignore:
Timestamp:
08/05/2017 05:07:26 PM (7 years ago)
Author:
Thomas Lopatic <thomas@…>
Branches:
master
Children:
5fa5369
Parents:
c3f113d
Message:

Successfully attached GDB.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • emu/main.c

    rc3f113d r7cc6ac0  
    2525static verb_flag_t verb_flags[] = {
    2626        { "sdl", &sdl_verbose },
     27        { "gdb", &gdb_verbose },
    2728        { "cpu", &cpu_verbose },
    2829        { "fpu", &fpu_verbose },
     
    128129}
    129130
     131static int32_t gdb_thread(void *data)
     132{
     133        (void)data;
     134
     135        gdb_loop();
     136        return 0;
     137}
     138
    130139int32_t main(int32_t argc, char *argv[])
    131140{
    132141        parse_args(argc, argv);
    133142        sdl_init();
     143        gdb_init();
    134144        cpu_init();
    135145
    136146        SDL_AtomicSet(&run, 1);
    137         SDL_Thread *thr = SDL_CreateThread(cpu_thread, "cpu", NULL);
     147        SDL_Thread *thr_cpu = SDL_CreateThread(cpu_thread, "cpu", NULL);
    138148
    139         if (thr == NULL) {
     149        if (thr_cpu == NULL) {
     150                fail("SDL_CreateThread() failed: %s", SDL_GetError());
     151        }
     152
     153        SDL_Thread *thr_gdb = SDL_CreateThread(gdb_thread, "gdb", NULL);
     154
     155        if (thr_gdb == NULL) {
    140156                fail("SDL_CreateThread() failed: %s", SDL_GetError());
    141157        }
    142158
    143159        sdl_loop();
    144         SDL_WaitThread(thr, NULL);
     160
     161        SDL_WaitThread(thr_cpu, NULL);
     162        SDL_WaitThread(thr_gdb, NULL);
    145163
    146164        cpu_quit();
     165        gdb_quit();
    147166        sdl_quit();
    148167        return 0;
Note: See TracChangeset for help on using the changeset viewer.