Project Documentation
#1
Hello guys,

I have worked on a documentation of the EE recompiler: http://wiki.pcsx2.net/index.php/PCSX2_Do...Recompiler

It isn't yet finish but it gives you already a good overview of the recompiler. Feel free to improve it (or give your feedback)

I would like also to concentrate others doc in this wiki. I think it will be interesting to port http://forums.pcsx2.net/Thread-How-to-cr...er-GS-dump

And also this draft:

Code:
Here an overview of severals way to debug PCSX2 on Linux (quick and dirty post).

*************************************************
1/ Debugging PCSX2 or generate a backtrace
* use dev or debug build to have debug information
* If the backtrace contains ???, it means you miss debug symbol from external libraries. Hint: search -dbg packages of your distribution.

# Use this command to start gdb (adapt the path to your executable)
gdb ./bin/pcsx2-dbg

# inside the gdb prompt you need to disable segmentation fault
(gdb) handle SIGSEGV noprint

# Now you can run the program
(gdb) run

# Do the action that trigger the crash
# If you can't access the gdb prompt, hit CTRL-C to stop PCSX2

# Then you can dump the trace with
(gdb) thread apply all bt
# Same with extra printing of local variable
(gdb) thread apply all bt full

WARNING: I'm not sure gdb will stop correctly if you hit a SIGSEGV in plugins

2/ Address Sanitizer
PCSX2 supports a special build mode to check wrong memory access (which often lead to segmentation fault)
It can be enabled with the --asan flags

./build.sh --asan

PCSX2 uses a special handler for SIGSEGV signal so you need to notify the checker at run-time. Typically you must start the executable this way

ASAN_OPTIONS=allow_user_segv_handler=1 ./bin/pcsx2-dbg

3/ GS dump
3a/ generate GS dump
* few frames: CTRL+F8
* more frames: CTRL+SHIFT+F8, hold SHIFT

The dump will be created in your snapshot directory. Hint check .gs extension files.

3b/ replay the GS dump
* Build PCSX2 with this option -DBUILD_REPLAY_LOADERS=TRUE
It will create the pcsx2_GSReplayLoader executable
Note: I would advice to save it somewhere.

* The executable requires 3 arguments
1/ the GSdx plugin => bin/plugins/libGSdx-0.1.16.so
2/ the .gs file =>  bin/snaps/god_of_war.gs
3/ the directory that contains the ini file => bin/inis

3c/ Useful option to analysis the dump
* linux_replay = n <= replay the trace n times

* dump = 1 <= Enable dumping infrastructure
* save = 1 <= dump render target
* savez = 1 <= dump depth target
* saven = nnn <= first texture to dump

3d/ For the record it is possible to replay GS dump in GPU debugger such as Apitrace
* if you know any other debugger on Linux, rise your hand.

Who would like to help?
Reply

Sponsored links

#2
Looks Good !  pretty much no clue about the EE docs though Tongue2

though would be glad to help on parts which would be feasible to work on. Smile

some nitpicks on the docs :

Quote: A more complex implementation will use the page fault signal handler mechanism to detect invalid write. Guess what, we choose the later.

later -> latter

would also be nice to provide the code examples for the dispatchers. do you think it'd be nice ?

example for "EventTest" & DispatchBlockDiscard:

Code:
static DynGenFunc* _DynGen_DispatcherEvent()
{
    u8* retval = xGetPtr();

    xCALL( recEventTest );

    return (DynGenFunc*)retval;
}


Code:
static DynGenFunc* _DynGen_DispatchBlockDiscard()
{
    u8* retval = xGetPtr();
    xCALL(dyna_block_discard);
    xJMP(ExitRecompiledCode);
    return (DynGenFunc*)retval;
}
We're supposed to be working as a team, if we aren't helping and suggesting things to each other, we aren't working as a team.
- Refraction
Reply
#3
@ssakash - it's a wiki, have at it Wink
[Image: XTe1j6J.png]
Gaming Rig: Intel i7 6700k @ 4.8Ghz | GTX 1070 TI | 32GB RAM | 960GB(480GB+480GB RAID0) SSD | 2x 1TB HDD
Reply
#4
I want to limit code as much as possible. It will go out sync quickly. It will become too verbose. I prefer adding some hint (function/variable name etc...). If people want more info they need to open the source
Reply
#5
@ssakash
For you the best will to try to boot a linux machine. Generate a dump/replay it. Generate some backtrace. This way you could write/do the documentation. EE is conplex. Beside I'm trying to change the code in parallal.
Reply
#6
Quote:EE is conplex. Beside I'm trying to change the code in parallal.

Yeah, I saw your _DynGen_DispatcherEvent function commit.

Quote:For you the best will to try to boot a linux machine. Generate a dump/replay it. Generate some backtrace. This way you could write/do the documentation

haven't really used Linux before, I'm rather confused on which distribution to get. hmm .. Ubuntu it is then
We're supposed to be working as a team, if we aren't helping and suggesting things to each other, we aren't working as a team.
- Refraction
Reply
#7
Yeah Ubuntu is the Windows of the Linux world Tongue
[Image: ref-sig-anim.gif]

Reply
#8
I have managed to set up my ubuntu distro and would probably experiment stuffs when I get some free time.

on the other hand, just happened to take a look at this guide. I think someone should probably remove the second Additional external links provided at the guide ...
Reply
#9
(12-15-2015, 05:57 PM)ssakash Wrote: on the other hand, just happened to take a look at this guide. I think someone should probably remove the second Additional external links provided at the guide ...

I removed the link.
Reply




Users browsing this thread: 1 Guest(s)