-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use it? #4
Comments
I've never used this before. And until today, I never looked at the code here either. From ps2gdbStub.c, we have a comment that explains how to use it: The code depends on ps2ips.irx, which means you need ps2ip.irx and friends too. It does not support debugging IOP modules. |
Hi, Back in 2009 (time flies!) under the nickname of cosmito I have posted in forums.ps2dev.org about my experiences with it. I found the posts in Lukasz's mirror: http://lukasz.dk/mirror/forums.ps2dev.org/viewtopicb920.html?t=4430 The second post has a walkthrough of what I did to use ps2gdb. At the time I managed to get ps2gdb going but there was definitely something odd over there, since when debugging the program execution jumped erractically back and forth when stepping though the statements. Possibly was some PS2 MIPS specific architecture different that caused it - but gdb on the PSP did worked fine, as I had (still have) a PSP and have tried it. One of the main reason I stop doing dev for the ps2 was the fact there wasn't a way to do proper interactive debugging, so no immediate way of getting a callstack during execution, for example. Using printf becomes way to time consuming so I got sick of it. Perhaps someone wants to continue where I stopped. |
Hello @pedroduarte0, Based on my poor knowledge and how it is working in PSP, I think that most probably is the best starting point to make this work. What PSP has is:
I hope that @sp193, @cosmito, @mlafeldt or @lukaszdk could bring some light here, as least for clarifying how this should work. Thanks |
I did debugging with the DSNET tools (over DECI2), not with GDB. Sony-licensed developers used DSEDB and DSIDB, to interface with the debuggers within the EE and IOP kernels. The IOP kernel has no DECI2 manager loaded in CEX and DEX by default, but the EE kernel has the EE-side DECI2 manager (and hence the debugger) integrated into it. Before I got my DTL-T10000H, I created RDB, based on some components from Silverbull's Kermit ODEM project. It functions similarly to the Sony TDB startup card. While the stock CEX/DEX kernel has no support for the thread extensions (thread debugging commands like As for IOP side debugging, that's not so easily supported because it is more complicated; the IOP to HOST driver must be capable of operating, even when threads are suspended. Otherwise, the PS2 will hang when DSIDB pauses thread execution. |
Thanks @sp193 for you info. #include <stdio.h>
int gdb_stub_main( int argc, char *argv[] );
static int counter = 0;
void printHello() {
printf("Hello world! counter = %i\n", counter);
}
void afterPrint() {
counter ++;
}
int main(int argc, char *argv[] )
{
printf("Starting gdb_stub_main!!!\n");
gdb_stub_main(argc, argv);
printf("Finished gdb_stub_main!!!\n");
while(1) {
printHello();
afterPrint();
}
return 0;
} With this example, I was trying to put a breakpoint and inspect the value of the
So, it more or less looks to be working, however, I think that it isn't ready to be used on a daily basis. Thanks |
Indeed thanks @sp193 for insight on how things worked out on your case. But still, I came across the oddness of when stepping though the instructions, the callstack would erratically advance back and forth... Might be that ps2gdb is not properly patched to support the modified MIPS processor used by the PS2. I also attempted to use the network stack from SMS Media Player which is faster than the ps2sdk one but somehow I didn't managed to have success there. I bet there would be someone more experienced than me into the low level aspects of the PS2 that could make it. So I see some options:
At the time there was in development a project called PS2rd (https://github.com/mlafeldt/ps2rd) on remote debugging but targeted to the gaming side. I can see @mlafeldt was involved. Regarding the network stack, I wonder how would be possible to have a network stack completely running on the EE, and the limitations. Would it be possible to have it running on a thread? How would the client applications interact with it? How would it be its resiliency against being stopped/destructed by other applications running on the EE? Do you know some of these answers @sp193 or @mlafeldt ? |
I cannot really comment on why GDB isn't working well, but I can comment on LWIP because I have spent time between 2012-2017 to improve the networking aspect of our PS2SDK. Personally, I think running LWIP on the IOP should have been OK. I mean, it worked for Sony, when they made the TDB startup card. And it also worked great when I was using RDB. So something must have not worked right. I ported LWIP 1.4.1, then 2.0.0 to the PS2SDK. It can be run from either the EE or IOP, depending on the developer's needs. To provide an interface between the EE and IOP options, the PS2SDK's SMAP driver is registered with NETMAN (NETwork MANager). NETMAN also provides APIs to control and monitor the network interface, which includes the ability to override the link operation mode. The old versions of DEV9 and SMAP were previously plagued by a few problems, such as lacking DMA support and hardware-specific logic from Sony. LWIP needed to be patched to properly support our kernel functions. For example, our kernel functions like SignalSema cannot be run from an interrupt-inhibited state, which LWIP doesn't abide by. We're also using cooperative multitasking, which LWIP wasn't originally well-designed for. The SMAP itself (on seemingly all models) seems to have a hardware bug, whereby the Rx FIFO may hang up under heavy load. There is a need to work around this in software. I may have forgot the significance of it, but I recall that LWIP v2.0.0 was a better fit for the IOP, compared to the older versions. They made the core locking feature a stable feature, which helped the IOP drastically because it reduced the number of context-switches. As a result, I recall seeing that its performance is even ahead of SMSTCPIP's (but perhaps not its footprint). By the way, I have also observed that some network adaptors (e.g. my Realtek RTL8102E) do not seem to support Ethernet flow control with the official Realtek driver, as of 2017. If such a device is connected to the PS2's network adaptor, performance may become poor during bulk data transfers because the IOP cannot keep up - but yet there's no support for flow control to slow down the sender. If we limit the window size, performance also goes down. I think there isn't a nice way to handle this scenario, other than putting another device between the PS2 and the PC. I don't think that SMSTCPIP is issue-free. We're using it in OPL, but despite spending time to backport patches from LWIP to it, it has been reported to still occasionally freeze up under specific conditions. |
Thanks for the update @sp193, since you worked from 2012 onwards and I left in 2011 I did experienced the old stack, not the improvements you mentioned above. So perhaps performance should be certainly better now. Great work indeed! |
Actualmente desarrollo en la ps2 veo que usted sabe del tema y conosi a cosmito almenos algunos proyectos como Doom y quisiera preguntar si podemos charlar del tema |
example on how to use it (source here) |
Awesome! |
Hello,
Not sure if this should be an issue but I have been giving a try and reading into the internet but I didn't find a way to make it work.
Basically I would like to be able to debug our PS2
elf
applications. The main functionality that I see as a must-have to have breakpoints and a way to inspect the value of variables.Do we have more information about how to use it? In this case, should we improve our
Readme
?Pinging @sp193 because most probably he is the one that knows more about this.
Thanks
The text was updated successfully, but these errors were encountered: