Compiler Issues


M-.-n

Member
Joined
May 28, 2005
Messages
160
Location
Brussels, Belgium
Website
discodirt.10pm.org
Hi all !

I've been fiddling yesterday with my brand new 2x and porting some of the piggy code. Unfortunately, I seem to have run into an issue with the arm-linux-g++ compiler under windows. I've boiled down the problem to a minimal set of code available here:

demo.rar

It is basically the demo sample with a template list & item instanciated before displaying the image (kind of my ridiculous only way to debug).

If I comment

Code:
	list.Insert(item);

The sample run fine. If I uncomment it ,the program locks.

What should I do ? I've been using this list class on countless platforms (including the GP32) so I don't think there's anything bogus there. I guess the first thing would be to try on a unix box if the problem is the same.. could a unix gearhead do this for me and tell me if it runs ?

Cheers for any help !
 
The only things I can see are:

Isn't the STL list template supported?

Code:
class ItemList:public T_SimpleList<MyItem> {
};
.....
MyItem *item=new MyItem();
	list.Insert(item);

You seem to be adding a pointer of an object to a list of objects rather then a list of object pointers (which is strange because I would have thought it give a compiler error.

Code:
class ItemList:public T_SimpleList<MyItem*> {
};
.....
MyItem *item=new MyItem();
	list.Insert(item);
 
This is not a STL code but my own (although mybe a last resort would be to try mapping my implementation through STL.. but I'd rather avoid that)n.

The list is supposed to provide support for adding new object both through references or pointer:

Code:
	virtual void Insert(Item&);
	virtual void Insert(Item*);

So syntaxically it is correct; the compiler does not have to complain about that :)
 
M-.-n posted on Feb 25 2006 at 11:10 AM said:
could a unix gearhead do this for me and tell me if it runs ?

Just to make myself totally clear, by this I mean "could someone with a linux box compile this for the GP2x and tell me if it runs that way" :)
 
Last edited by a moderator:
With g++ on Unix I get

mook:~/demo/demo# ./a.out
a.out: T_SimpleList.cpp:27: void T_SimpleList<Item>::lock() [with Item = MyItem]: Assertion `!_locked' failed.
Aborted

Call stack:
0xb7c8f7a7 in raise () from /lib/tls/libc.so.6
(gdb) where
#0 0xb7c8f7a7 in raise () from /lib/tls/libc.so.6
#1 0xb7c9104b in abort () from /lib/tls/libc.so.6
#2 0xb7c88755 in __assert_fail () from /lib/tls/libc.so.6
#3 0x08048d30 in T_SimpleList<MyItem>::lock (this=0xbfd89cc4)
at T_SimpleList.cpp:27
#4 0x080490de in T_SimpleList<MyItem>::Insert (this=0xbfd89cc4,
item=@0x805e808) at T_SimpleList.cpp:43
#5 0x08048cb1 in T_SimpleList<MyItem>::Insert (this=0xbfd89cc4,
item=0x805e808) at T_SimpleList.cpp:63
#6 0x08048aa6 in main (argc=1, argv=0xbfd89d64) at demo.cpp:49

Vars (info locals):
frame 3:
__PRETTY_FUNCTION__ = "void T_SimpleList<Item>::lock() [with Item = MyItem]"
frame 4:
n = (Node<MyItem> *) 0x4
__PRETTY_FUNCTION__ = "void T_SimpleList<Item>::Insert(Item&) [with Item = MyItem]"
frame 5:
__PRETTY_FUNCTION__ = "void T_SimpleList<Item>::Insert(Item*) [with Item = MyItem]"
frame 6:
screen = (SDL_Surface *) 0x805e760
done = 0
list = {<T_SimpleList<MyItem>> = {<I_List<MyItem>> = {
_vptr.I_List = 0x8049588}, _first = 0x0, _last = 0x0, _isOwner = false,
_locked = true}, <No data fields>}
item = (MyItem *) 0x805e808
bitmap = (SDL_Surface *) 0x0

Vars (this):
frame 3:
(gdb) print *this
$2 = {<I_List<MyItem>> = {_vptr.I_List = 0x8049588}, _first = 0x0,
_last = 0x0, _isOwner = false, _locked = true}

Thanks,

Mark
 
Solution - don't return before unlock in contains!

Still crashes, but in drawsprite instead...

Mark

edit: Actually it doesn't really fail. Just because its looking under /mnt/sd for the picture and I was running it elsewhere in my test. I get an Nvideo logo thing.
 
thanks a hundred fuckin mil dude !

I have no idea why this happens but I commented the lock / unlock from the list ( they're not really significant at this stage anyway ) and I can see my user interface now !!!!!

I owe ya! How did you get the assert output ? Is it with a serial cable ? The usb ?

Back on track for dah piggy ::::
 
I built it on my Linux box, much easier than testing on GP2X:). That said you'd see it with the serial too.

It happens due to the lock not being released.in the function "Contains". Code reads something like:

void Contains()
{
lock();
return;
unlock();
}

Thanks,

Mark
 
Back
Top