PCSX2 Documentation/GNU Debugger Tips: Difference between revisions
Jump to navigation
Jump to search
Line 16: | Line 16: | ||
==Step by step execution== | ==Step by step execution== | ||
execute 1 instruction :step | *execute 1 instruction :step | ||
execute 1 C line of instruction, functions are a 1 line instruction:next | *execute 1 C line of instruction, functions are a 1 line instruction:next | ||
Same for ASM: nexti and stepi | *Same for ASM: nexti and stepi | ||
continue execution: continue | *continue execution: continue | ||
Add breakpoint to stop program: | *Add breakpoint to stop program: | ||
break <file>:<line> | *break <file>:<line> | ||
break <function> | *break <function> | ||
add a condition: break <file>:<line> if <ARG> == 0 | *add a condition: break <file>:<line> if <ARG> == 0 | ||
Print variable/memory/register | *Print variable/memory/register | ||
basic var: print <var> | *basic var: print <var> | ||
pointer var: print <*var> | *pointer var: print <*var> | ||
print memory: x <Oxlocation> | *print memory: x <Oxlocation> | ||
print register: print $<register_name> | *print register: print $<register_name> | ||
SIGSEGV/Segmentation fault | |||
==SIGSEGV/Segmentation fault== | |||
A program have a limited range of memory that it can access. When you try to read/write outside, the kernel generate an error named segmentation fault. It is a critical error and generally it just crash. It is a bit difficult on PCSX2 because recompiler use this mechanism for optimization. So segmentation fault inside recompiler are normal and expected. | A program have a limited range of memory that it can access. When you try to read/write outside, the kernel generate an error named segmentation fault. It is a critical error and generally it just crash. It is a bit difficult on PCSX2 because recompiler use this mechanism for optimization. So segmentation fault inside recompiler are normal and expected. | ||
You can control signal behavior with the handle command for example. | You can control signal behavior with the handle command for example. | ||
don't stop on SIGSEGV: handle SIGSEGV nostop | *don't stop on SIGSEGV: handle SIGSEGV nostop | ||
GDB basic gui | |||
==GDB basic gui== | |||
You can attach gdb to any process of your system. It will stop the process and show the current execution. | You can attach gdb to any process of your system. It will stop the process and show the current execution. | ||
hint: to get the pcsx2 process id: ps aux |grep pcsx2 | *hint: to get the pcsx2 process id: ps aux |grep pcsx2 | ||
attach the process: attach <Process_ID> | *attach the process: attach <Process_ID> | ||
GDB contains several views. You can see code source, ASM or register. | *GDB contains several views. You can see code source, ASM or register. | ||
source code: ctrl x ctrl A | *source code: ctrl x ctrl A | ||
2 panels: ctrl x ctrl 1 | *2 panels: ctrl x ctrl 1 | ||
3 panels: ctrl x ctrl 2 | *3 panels: ctrl x ctrl 2 |