VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've put UniPCemu in it's own folder, with the tools repository (https://bitbucket.org/superfury/tools.git) in parallel with it, so e.g.:
Z:\psp-projects\unipcemu containing the UniPCemu repository
Z:\psp-projects\tools containing the Tools repository(my global project workspace for e.g. PSP compiler support, customized SDL libraries and PSP emulators for testing(although it's probably a pretty old version by now)).

Trying to run the rebuild.bat(which worked fine until some point during the Windows 10 updates a year or so ago), gives me the following(I've cleared out the MinGW files to make it not conflict with the PSP compiler(due to incompatible .o file format):

File Not Found
psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O3 -G0 -Wall -IC:/pspsdk/psp/include/SDL -Dmain=SDL_main -D_PSP_FW_VERSION=150 -c -o ../../projects_build/UniPCemu/basicio/dskimage.o basicio/dskimage.c
psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O3 -G0 -Wall -IC:/pspsdk/psp/include/SDL -Dmain=SDL_main -D_PSP_FW_VERSION=150 -c -o ../../projects_build/UniPCemu/basicio/dynamicimage.o basicio/dynamicimage.c
psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O3 -G0 -Wall -IC:/pspsdk/psp/include/SDL -Dmain=SDL_main -D_PSP_FW_VERSION=150 -c -o ../../projects_build/UniPCemu/basicio/fopen64.o basicio/fopen64.c
psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O3 -G0 -Wall -IC:/pspsdk/psp/include/SDL -Dmain=SDL_main -D_PSP_FW_VERSION=150 -c -o ../../projects_build/UniPCemu/basicio/io.o basicio/io.c
psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O3 -G0 -Wall -IC:/pspsdk/psp/include/SDL -Dmain=SDL_main -D_PSP_FW_VERSION=150 -c -o ../../projects_build/UniPCemu/basicio/port_io.o basicio/port_io.c
psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O3 -G0 -Wall -IC:/pspsdk/psp/include/SDL -Dmain=SDL_main -D_PSP_FW_VERSION=150 -c -o ../../projects_build/UniPCemu/basicio/port_mapper.o basicio/port_mapper.c
psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O3 -G0 -Wall -IC:/pspsdk/psp/include/SDL -Dmain=SDL_main -D_PSP_FW_VERSION=150 -c -o ../../projects_build/UniPCemu/basicio/staticimage.o basicio/staticimage.c
psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O3 -G0 -Wall -IC:/pspsdk/psp/include/SDL -Dmain=SDL_main -D_PSP_FW_VERSION=150 -c -o ../../projects_build/UniPCemu/bios/bios.o bios/bios.c
psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O3 -G0 -Wall -IC:/pspsdk/psp/include/SDL -Dmain=SDL_main -D_PSP_FW_VERSION=150 -c -o ../../projects_build/UniPCemu/bios/biosmenu.o bios/biosmenu.c
bios/biosmenu.c: In function 'BIOS_breakpoint':
bios/biosmenu.c:6662: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [../../projects_build/UniPCemu/bios/biosmenu.o] Error 1

So the compiler is crashing on biosmenu.c for some unknown reason, at a line in the middle between two functions (the "}"-closing line of the BIOS_breakpoint() function).

Why would the compiler crash on that line? Can anyone see what's going wrong? It's probably giving that line for some reason, but I don't know why the compiler itself is crashing? I'm using the latest PSPSDK (0.11.2r3) from https://sourceforge.net/projects/minpspw/ for Windows. Can anyone tell me why this is crashing?

Edit: It seems to be crashing when compiling this function(commenting it out will make it compile without errors):

void BIOS_breakpoint()
{
char breakpointstr[8+1+4+1+1+1]; //32-bits offset, colon, 16-bits segment, mode if required, Ignore EIP/Ignore address and final character(always zero)!
cleardata(&breakpointstr[0],sizeof(breakpointstr));
//First, convert the current breakpoint to a string format!
switch ((BIOS_Settings.breakpoint>>SETTINGS_BREAKPOINT_MODE_SHIFT)) //What mode?
{
case 0: //No breakpoint?
sprintf(breakpointstr,"%04X:%04X",0,0); //seg16:offs16 default!
if ((BIOS_Settings.breakpoint>>SETTINGS_BREAKPOINT_IGNOREADDRESS_SHIFT)&1) //Ignore address?
{
strcat(breakpointstr,"M"); //Ignore mode!
}
else if ((BIOS_Settings.breakpoint>>SETTINGS_BREAKPOINT_IGNOREEIP_SHIFT)&1) //Ignore EIP?
{
strcat(breakpointstr,"I"); //Ignore EIP!
}
break;
case 1: //Real mode?
sprintf(breakpointstr,"%04X:%04X",(word)((BIOS_Settings.breakpoint>>SETTINGS_BREAKPOINT_SEGMENT_SHIFT)&SETTINGS_BREAKPOINT_SEGMENT_MASK),(word)((BIOS_Settings.breakpoint&SETTINGS_BREAKPOINT_OFFSET_MASK)&0xFFFF)); //seg16:offs16!
if ((BIOS_Settings.breakpoint>>SETTINGS_BREAKPOINT_IGNOREADDRESS_SHIFT)&1) //Ignore address?
{
strcat(breakpointstr,"M"); //Ignore mode!
}
else if ((BIOS_Settings.breakpoint>>SETTINGS_BREAKPOINT_IGNOREEIP_SHIFT)&1) //Ignore EIP?
{
strcat(breakpointstr,"I"); //Ignore EIP!
}
break;
case 2: //Protected mode?
sprintf(breakpointstr,"%04X:%08XP",(word)((BIOS_Settings.breakpoint>>SETTINGS_BREAKPOINT_SEGMENT_SHIFT)&SETTINGS_BREAKPOINT_SEGMENT_MASK),(uint_32)(BIOS_Settings.breakpoint&SETTINGS_BREAKPOINT_OFFSET_MASK)); //seg16:offs16!
if ((BIOS_Settings.breakpoint>>SETTINGS_BREAKPOINT_IGNOREADDRESS_SHIFT)&1) //Ignore address?
{
strcat(breakpointstr,"M"); //Ignore mode!
}
else if ((BIOS_Settings.breakpoint>>SETTINGS_BREAKPOINT_IGNOREEIP_SHIFT)&1) //Ignore EIP?
{
strcat(breakpointstr,"I"); //Ignore EIP!
}
break;
case 3: //Virtual 8086 mode?
sprintf(breakpointstr,"%04X:%04XV",(word)((BIOS_Settings.breakpoint>>SETTINGS_BREAKPOINT_SEGMENT_SHIFT)&SETTINGS_BREAKPOINT_SEGMENT_MASK),(word)((BIOS_Settings.breakpoint&SETTINGS_BREAKPOINT_OFFSET_MASK)&0xFFFF)); //seg16:offs16!
if ((BIOS_Settings.breakpoint>>SETTINGS_BREAKPOINT_IGNOREADDRESS_SHIFT)&1) //Ignore address?
{
strcat(breakpointstr,"M"); //Ignore mode!
}
else if ((BIOS_Settings.breakpoint>>SETTINGS_BREAKPOINT_IGNOREEIP_SHIFT)&1) //Ignore EIP?
{
strcat(breakpointstr,"I"); //Ignore EIP!
}
break;
default: //Just in case!
break;
}
//I is added with bit set when it's done(Ignore EIP).

BIOSClearScreen(); //Clear the screen!
BIOS_Title("Breakpoint"); //Full clear!
EMU_locktext();
EMU_gotoxy(0, 4); //Goto position for info!
Show last 73 lines
	GPU_EMU_printscreen(0, 4, "Address: "); //Show the filename!
EMU_unlocktext();
byte mode; //The mode to use!
word semicolonpos;
char *temp;
word maxsegmentsize = 4;
word maxoffsetsize = 4;
word segment; //The segment buffer to load!
uint_32 offset; //The offset buffer to load!
if (BIOS_InputAddressWithMode(9, 4, &breakpointstr[0], sizeof(breakpointstr)-1)) //Input text confirmed?
{
if (strcmp(breakpointstr, "") != 0) //Got valid input?
{
//Convert the string back into our valid numbers for storage!
mode = 1; //Default to real mode!
byte ignoreEIP = 0;
byte ignoreAddress = 0;
ignoreEIP = (breakpointstr[strlen(breakpointstr)-1]=='I'); //Ignore EIP?
if (ignoreEIP) breakpointstr[strlen(breakpointstr)-1] = '\0'; //Take off the mode identifier!
ignoreAddress = (breakpointstr[strlen(breakpointstr)-1]=='M'); //Ignore address?
if (ignoreAddress) breakpointstr[strlen(breakpointstr)-1] = '\0'; //Take off the mode identifier!
switch (breakpointstr[strlen(breakpointstr)-1]) //Identifier for the mode?
{
case 'P': //Protected mode?
mode = 2; //Protected mode!
breakpointstr[strlen(breakpointstr)-1] = '\0'; //Take off the mode identifier!
maxoffsetsize = 8; //We're up to 8 hexadecimal values in this mode!
goto handlemode;
case 'V': //Virtual 8086 mode?
mode = 3; //Virtual 8086 mode!
breakpointstr[strlen(breakpointstr)-1] = '\0'; //Take off the mode identifier!
default: //Real mode?
handlemode: //Handle the other modes!
temp = &breakpointstr[0]; //First character!
for (;(*temp && *temp!=':');++temp); //No seperator yet?
if (*temp!=':') //No seperator found?
{
goto abortcoloninput; //Invalid: can't handle!
}
if (*(temp+1)=='\0') //Invalid ending?
{
goto abortcoloninput; //Invalid: can't handle colon at the end!
}
//Temp points to the colon!
semicolonpos = temp-&breakpointstr[0]; //length up to the semicolon, which should be valid!
if ((semicolonpos==0) || (semicolonpos>maxsegmentsize)) //Too long segment?
{
goto abortcoloninput; //Invalid: can't handle segment length!
}
if (((strlen(breakpointstr)-semicolonpos)-1)>maxoffsetsize) //Too long segment?
{
goto abortcoloninput; //Invalid: can't handle segment length!
}

breakpointstr[semicolonpos] = '\0'; //Convert the semicolon into an EOS character to apply the string length!
segment = hex2int(&breakpointstr[0]); //Convert the number to our usable format!
offset = hex2int(&breakpointstr[semicolonpos+1]); //Convert the number to our usable format!

//Apply the new breakpoint!
BIOS_Settings.breakpoint = (((uint_64)mode&3)<<SETTINGS_BREAKPOINT_MODE_SHIFT)|(((ignoreEIP?1LLU:0LLU)<<SETTINGS_BREAKPOINT_IGNOREEIP_SHIFT))|(((ignoreAddress?1LLU:0LLU)<<SETTINGS_BREAKPOINT_IGNOREADDRESS_SHIFT))|(((uint_64)segment&SETTINGS_BREAKPOINT_SEGMENT_MASK)<<SETTINGS_BREAKPOINT_SEGMENT_SHIFT)|((uint_64)offset&SETTINGS_BREAKPOINT_OFFSET_MASK); //Set the new breakpoint!
BIOS_Changed = 1; //We've changed!
break;
}
}
else //Unset?
{
BIOS_Changed = BIOS_Changed||((BIOS_Settings.breakpoint!=0)?1:0); //We've changed!
BIOS_Settings.breakpoint = 0; //No breakpoint!
}
}
abortcoloninput:
BIOS_Menu = 35; //Goto CPU menu!
}

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 3, by superfury

User metadata
Rank l33t++
Rank
l33t++

It seems to be faulting when the hex2int lines up to the break instruction directly after it isn't commented out. I've moved that piece of code to a seperate function. Commenting out the function call makes it compile without problems&errors, but enabling the function call ( https://bitbucket.org/superfury/unipcemu/src/ … enu.c?at=master line 6641) makes it crash the compiler still. Commenting it out with // will make the compile successfull(although destroying the whole setting being applied)? Why is the compiler struggling with that simple code(block or function call)?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 2 of 3, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've managed to get UniPCemu compiled again, although it's giving lots of little errors:
- I had to disable the Settings menu's breakpoint option, because the compiler will crash if it's used in it's entirety(only on PSP builds).
- I've modified lots of other code in order to make it not complain about lots of stuff. Somehow it complains about the %u sprintf constants being 16-bit, even though it should be 32-bit or 64-bit values(e.g. long or long long variables) that are used with it? Any other gcc-based compiler(Android/Windows) doesn't complain one bit?

It seems to compile somewhat on MInPSPw 0.9.6+, but for some reason it complains about a missing isfinitef function when using version 0.11.2? Afaik isfinitef is supposed to be a #define? It's the libm.a file that's somehow causing problems with the most recent MinPSPw builds? The 0.10.0 version seems to use gcc 4.3.5 according to "psp-gcc -v"?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 3 of 3, by superfury

User metadata
Rank l33t++
Rank
l33t++

Just tried some other versions of the minimalist PSPSDK. It seems 0.11.1 and up compiles without errors, but screws up linking because of the missing isfinitef 'function' linkage(should be a macro afaik)?

And the first older version I can find is 0.10.0, which compiles, but complains about nearly every %u (s)printf on 32-bit or 64-bit parameters needing to be an 'unsigned int', which is only 16-bit(or 32-bit at the most), truncating any 64-bit data(and/or 32-bit data)?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io