In case of a memory allocation failure, print current readout
This commit is contained in:
parent
d9233b3440
commit
4d322feacc
|
@ -561,8 +561,8 @@ error:
|
|||
fd = ashmem_create_region(0,RAM_SIZE + VRAM_SIZE +ARAM_SIZE);
|
||||
if (false)//this causes writebacks to flash -> slow and stuttery
|
||||
{
|
||||
fd = open("/data/data/com.example.droidcast/dcnzorz_mem",O_CREAT|O_RDWR|O_TRUNC,S_IRWXU|S_IRWXG|S_IRWXO);
|
||||
unlink("/data/data/com.example.droidcast/dcnzorz_mem");
|
||||
fd = open("/data/data/com.reicast.emulator/files/dcnzorz_mem",O_CREAT|O_RDWR|O_TRUNC,S_IRWXU|S_IRWXG|S_IRWXO);
|
||||
unlink("/data/data/com.reicast.emulator/files/dcnzorz_mem");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -155,12 +155,43 @@ void VArray2::LockRegion(u32 offset,u32 size)
|
|||
}
|
||||
}
|
||||
|
||||
void print_mem_addr()
|
||||
{
|
||||
FILE *ifp, *ofp;
|
||||
char *mode = "r";
|
||||
char outputFilename[] = "/data/data/com.reicast.emulator/files/reicast_mem.txt";
|
||||
|
||||
ifp = fopen("/proc/self/maps", mode);
|
||||
|
||||
if (ifp == NULL) {
|
||||
fprintf(stderr, "Can't open input file /proc/self/maps!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ofp = fopen(outputFilename, "w");
|
||||
|
||||
if (ofp == NULL) {
|
||||
fprintf(stderr, "Can't open output file %s!\n",
|
||||
outputFilename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char line [ 512 ];
|
||||
while (fgets(line, sizeof line, ifp) != NULL) {
|
||||
fprintf(ofp, "%s\n", line);
|
||||
}
|
||||
|
||||
fclose(ifp);
|
||||
fclose(ofp);
|
||||
}
|
||||
|
||||
void VArray2::UnLockRegion(u32 offset,u32 size)
|
||||
{
|
||||
u32 inpage=offset & PAGE_MASK;
|
||||
u32 rv=mprotect (data+offset-inpage, size+inpage, PROT_READ | PROT_WRITE);
|
||||
if (rv!=0)
|
||||
{
|
||||
print_mem_addr();
|
||||
printf("mprotect(%08X,%08X,RW) failed: %d | %d\n",data+offset-inpage,size+inpage,rv,errno);
|
||||
die("mprotect failed ..\n");
|
||||
}
|
||||
|
|
|
@ -60,6 +60,8 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
home_directory = mPrefs.getString("home_directory", home_directory);
|
||||
JNIdc.config(home_directory);
|
||||
|
||||
getFilesDir().mkdir();
|
||||
|
||||
mUEHandler = new Thread.UncaughtExceptionHandler() {
|
||||
public void uncaughtException(Thread t, Throwable error) {
|
||||
if (error != null) {
|
||||
|
|
Loading…
Reference in New Issue