Development:Debugging Crash In Thunks

From FEX-Emu Wiki
Jump to navigation Jump to search

Once Thunks are enabled

  • Once you've verified your crash is in a thunk then this becomes quite a bit easier
 gdb --args FEXInterpreter /usr/bin/vulkaninfo
 Thread 1 "FEXInterpreter" received signal SIGSEGV, Segmentation fault.
 0x0000007fc82240f4 in tu_CreateDevice () from /lib/aarch64-linux-gnu/libvulkan_freedreno.so
 (gdb) bt
 #0  0x0000007fc82240f4 in tu_CreateDevice () from /lib/aarch64-linux-gnu/libvulkan_freedreno.so
 #1  0x0000007fc8642b94 in function_traits<decltype (&(fexfn_unpack_libvulkan_freedreno_vkCreateDevice(fexfn_packed_args_libvulkan_freedreno_vkCreateDevice*)))>::result_t fexfn_type_erased_unpack<&(fexfn_unpack_libvulkan_freedreno_vkCreateDevice(fexfn_packed_args_libvulkan_freedreno_vkCreateDevice*))>(void*) () from /usr/lib/fex-emu/HostThunks//libvulkan_freedreno-host.so
 #2  0x0000007fe25e4028 in ?? ()
 Backtrace stopped: previous frame inner to this frame (corrupt stack?)
  • Okay, that's a direct crash in Turnip, let's rebuild Mesa with a debug build and try again
 Thread 1 "FEXInterpreter" received signal SIGSEGV, Segmentation fault.
 0x0000007fc80bc600 in tu_CreateDevice (physicalDevice=0x5559947aa0, pCreateInfo=0x7ff75fda20, pAllocator=0x0, pDevice=0x7fcbe7b358) at ../src/freedreno/vulkan/tu_device.c:1632
 1632       memset(ptr, 0x42, 16);
 (gdb) bt
 #0  0x0000007fc80bc600 in tu_CreateDevice (physicalDevice=0x5559947aa0, pCreateInfo=0x7ff75fda20, pAllocator=0x0, pDevice=0x7fcbe7b358) at ../src/freedreno/vulkan/tu_device.c:1632
 #1  0x0000007fc80eab9c in vk_tramp_CreateDevice (physicalDevice=0x5559947aa0, pCreateInfo=0x7ff75fda20, pAllocator=0x0, pDevice=0x7fcbe7b358) at src/vulkan/runtime/vk_dispatch_trampolines.c:78
 #2  0x0000007fc8642b94 in function_traits<decltype (&(fexfn_unpack_libvulkan_freedreno_vkCreateDevice(fexfn_packed_args_libvulkan_freedreno_vkCreateDevice*)))>::result_t fexfn_type_erased_unpack<&(fexfn_unpack_libvulkan_freedreno_vkCreateDevice(fexfn_packed_args_libvulkan_freedreno_vkCreateDevice*))>(void*) () from /usr/lib/fex-emu/HostThunks//libvulkan_freedreno-host.so
 #3  0x0000007fe25e426c in ?? ()
  • Okay the crash is at.. `tu_device:1632`, let's go and debug that line
 1631    void* ptr = (void*)1;
 1632    memset(ptr, 0x42, 16);
  • Who put that in there?!