GDB使用SIGTRAP信号意外中断

时间:2018-03-05 21:00:36

标签: c macos debugging gdb sdl

当我从调试器收到此错误时,我正在使用C创建一个8080模拟器:

Starting program: /Users/khalid/prog/8080_emulator/emulator 
[New Thread 0x1003 of process 35249]
[New Thread 0x1303 of process 35249]
During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.

当我使用断点时,当我不使用断点时,我得到此输出。在它崩溃之前,程序将启动四个线程然后开始运行。我不确定是什么导致了这一点,但任何帮助表示赞赏!

我正在运行macOS High Sierra 10.13.1,我的模拟器GitHub仓库在这里:https://github.com/khalludi/8080emulator

这是我的gdb配置:

configure --host=x86_64-apple-darwin17.3.0 --target=x86_64-apple-darwin17.3.0
         --with-auto-load-dir=:${prefix}/share/auto-load
         --with-auto-load-safe-path=:${prefix}/share/auto-load
         --with-expat
         --with-gdb-datadir=/usr/local/Cellar/gdb/8.1/share/gdb (relocatable)
         --with-jit-reader-dir=/usr/local/Cellar/gdb/8.1/lib/gdb (relocatable)
         --without-libunwind-ia64
         --without-lzma
         --with-python=/System/Library/Frameworks/Python.framework/Versions/2.7
         --without-guile
         --with-separate-debug-dir=/usr/local/Cellar/gdb/8.1/lib/debug (relocatable)
         --without-babeltrace

另外,这些是调试符号:

khalid$ nm emulator
0000000100001020 T _Emulate8080Op
0000000100007640 T _MachineIN
00000001000076f0 T _MachineOUT
0000000100000f20 T _Parity
00000001000080c4 D _SCREEN_HEIGHT
00000001000080c0 D _SCREEN_WIDTH
                 U _SDL_AllocPalette
                 U _SDL_CreateWindow
                 U _SDL_DestroyWindow
                 U _SDL_FreeSurface
                 U _SDL_GetError
                 U _SDL_GetWindowSurface
                 U _SDL_Init
                 U _SDL_Quit
                 U _SDL_UpdateWindowSurface
                 U _SDL_UpperBlit
0000000100000fa0 T _UnimplementedInstruction
                 U ___stack_chk_fail
                 U ___stack_chk_guard
0000000100000000 T __mh_execute_header
0000000100007600 T _closeMedia
                 U _exit
                 U _fopen
                 U _fread
                 U _fseek
                 U _ftell
00000001000080e0 S _gImage
00000001000080d8 S _gScreenSurface
00000001000080d0 S _gWindow
0000000100007760 T _getMicrotime
                 U _gettimeofday
0000000100007470 T _init
00000001000080cb S _int_enable
00000001000075e0 T _loadMedia
0000000100007790 T _main
                 U _malloc
                 U _memset
                 U _printf
                 U _rewind
00000001000080c8 S _shift0
00000001000080c9 S _shift1
00000001000080ca S _shift_offset
00000001000080e8 S _state
                 U dyld_stub_binder

我在其他地方读到将strip --strip-debug libpthread.so.0添加到gcc的C标志会有所帮助,但我尝试了这个并且它不起作用。

或者,有没有更好的方法来调试8080仿真器?再次,任何帮助表示赞赏!

0 个答案:

没有答案