First post, by superfury
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!
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