I tried to parse a utf-8 xml file with tinyxml while get a bus error.
main.cpp
Code: Select all
#include "tinyxml.h"
#include <pspkernel.h>
PSP_MODULE_INFO("sample", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
PSP_HEAP_SIZE_KB(20*1024);
TiXmlDocument* doc;
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, PSP_THREAD_ATTR_USER, 0);
if(thid >= 0)
sceKernelStartThread(thid, 0, 0);
return thid;
}
bool LoadMenu(){
doc = new TiXmlDocument("test.xml");
return doc->LoadFile();
}
void GenUI(TiXmlElement *elem){
return;
}
void ParseMenu(TiXmlDocument* doc1){
TiXmlElement* ele = doc1->FirstChildElement("Item");
do{
GenUI(ele);
ele = ele->NextSiblingElement();
}while(ele);
return;
}
int main() {
SetupCallbacks();
if(!LoadMenu()){
//when config file missing, exit program
sceKernelExitGame();
return 0;
}
ParseMenu(doc);
sceKernelExitGame();
return 0;
}
Code: Select all
host0:/> ./VersiPSP.prx
Load/Start host0:/VersiPSP.prx UID: 0x045EFC39 Name: "s
host0:/> Exception - Bus error (data)
Thread ID - 0x045E7745
Th Name - user_main
Module ID - 0x045EFC39
Mod Name - "sample"
EPC - 0x088047D4
Cause - 0x1000001C
BadVAddr - 0x10500440
Status - 0x40088613
zr:0x00000000 at:0xDEADBEEF v0:0x00000001 v1:0x00000A59
a0:0x00000000 a1:0x00000021 a2:0x00000A58 a3:0x08828984
t0:0x00000020 t1:0x088355A8 t2:0x0882DDF8 t3:0x088355BC
t4:0x00000000 t5:0xDEADBEEF t6:0xDEADBEEF t7:0xDEADBEEF
s0:0x00000000 s1:0x08835330 s2:0x00000001 s3:0x0BBBFEE0
s4:0x00000014 s5:0x00000013 s6:0xDEADBEEF s7:0xDEADBEEF
t8:0xDEADBEEF t9:0xDEADBEEF k0:0x0BBBFF00 k1:0x00000000
gp:0x088364A0 sp:0x0BBBFE08 fp:0x0BBBFEA0 ra:0x08804454
0x088047D4: 0x8C83001C '....' - lw $v1, 28($a0)
I can't get clue over this.
Thanks,