08.01.2018, 12:30
Hi!
Some libraries are using black magic and PAWN quirks to generate code at runtime (see amx_assembly). While this is wonderful and allows for expanding PAWN power beyond what it was supposed to be able to do, when something goes wrong, crashdetect returns complete garbage and debugging stuff is neigh impossible. Sometimes crashes are platform specific, code works fine on windows, but fails on linux boxes. So, what I need is a dumper of representation of current state of AMX loaded into samp server memory.
Did anyone already write such a program?
If not, I'm asking you for guidance in starting such an endeavour. My goal would be to write a GUI program running alongside running samp-server, with live AMX viewer. Maybe in future also current PAWN virtual machine state as well (current instruction and stuff), maybe even live memory editing (already possible in-game with samp-introspect mind you). I'd like to write it in C++, becuase why not learn something new along the way (I can mostly understand what is written in C++ (not necessarily what it does though), as long as there are no magic compiler-extension intricacies).
What I think I will need:
1. Some kind of DLL hooking (is there a linux .so equivalent?), or maybe plugin loaded the "official" way which will communicate with the debugger - but are there limitations for what plugin can read? More experienced PAWN coders than me used bugs in AMX VM to read (and write) whatever they want, however I don't know anything about writing plugins more than from what I have read in plugins section starting guide.
2. Cross-platform GUI. I think I'll need something like GTK (#edit: I meant Qt)? I don't know, I have superficial knowledge of those libraries from more than 5 years ago, maybe now there's some better contender.
3. I do not need a C++ tutorial, there's plenty of them on the internet.
4. Huh, I thought there would be more, but for MVP that's enough.
I know how to use OllyDBG, albeit slowly and not always with success.
I know how to write a dumper in PAWN, just read whole memory using #emit when OnRuntimeError is called, but I partially want to learn something new, and, well, adding debugging code directly in code being debugged adds noise (and when debugging someone else's problem, I don't want to edit the AMX provided).
I don't care about 3rd party plugins internal states, as there are better debugging tools for that.
Of course code will be on github under MIT license.
Quite a wall of text. So, what should I read first to start this project? What limitations are there in my way? Which crossplatform GUI library would be best for this specific use-case? Is using official plugin to do this is the best way? Which way would be best to broadcast read data to the debugger? Sockets for remote debugging?
Thank you.
Some libraries are using black magic and PAWN quirks to generate code at runtime (see amx_assembly). While this is wonderful and allows for expanding PAWN power beyond what it was supposed to be able to do, when something goes wrong, crashdetect returns complete garbage and debugging stuff is neigh impossible. Sometimes crashes are platform specific, code works fine on windows, but fails on linux boxes. So, what I need is a dumper of representation of current state of AMX loaded into samp server memory.
Did anyone already write such a program?
If not, I'm asking you for guidance in starting such an endeavour. My goal would be to write a GUI program running alongside running samp-server, with live AMX viewer. Maybe in future also current PAWN virtual machine state as well (current instruction and stuff), maybe even live memory editing (already possible in-game with samp-introspect mind you). I'd like to write it in C++, becuase why not learn something new along the way (I can mostly understand what is written in C++ (not necessarily what it does though), as long as there are no magic compiler-extension intricacies).
What I think I will need:
1. Some kind of DLL hooking (is there a linux .so equivalent?), or maybe plugin loaded the "official" way which will communicate with the debugger - but are there limitations for what plugin can read? More experienced PAWN coders than me used bugs in AMX VM to read (and write) whatever they want, however I don't know anything about writing plugins more than from what I have read in plugins section starting guide.
2. Cross-platform GUI. I think I'll need something like GTK (#edit: I meant Qt)? I don't know, I have superficial knowledge of those libraries from more than 5 years ago, maybe now there's some better contender.
3. I do not need a C++ tutorial, there's plenty of them on the internet.
4. Huh, I thought there would be more, but for MVP that's enough.
I know how to use OllyDBG, albeit slowly and not always with success.
I know how to write a dumper in PAWN, just read whole memory using #emit when OnRuntimeError is called, but I partially want to learn something new, and, well, adding debugging code directly in code being debugged adds noise (and when debugging someone else's problem, I don't want to edit the AMX provided).
I don't care about 3rd party plugins internal states, as there are better debugging tools for that.
Of course code will be on github under MIT license.
Quite a wall of text. So, what should I read first to start this project? What limitations are there in my way? Which crossplatform GUI library would be best for this specific use-case? Is using official plugin to do this is the best way? Which way would be best to broadcast read data to the debugger? Sockets for remote debugging?
Thank you.