BSON on arm cpu

287 views
Skip to first unread message

Claudio Bisegni

unread,
Apr 20, 2012, 4:57:36 PM4/20/12
to bs...@googlegroups.com
Hi,
i have compiled succesfully bson cpp on arm but i have problem when i ho to read string key. I receive the error:
terminate called after throwing an instance of 'bson::assertion'
  what():  BsonAssertion id: 13111 field not found, expected type 2
Aborted

the other type seem to work. Any ints about that? where i can search to try to resolve the issue?

thank sin advanced

Dwight Merriman

unread,
Apr 20, 2012, 5:08:24 PM4/20/12
to bs...@googlegroups.com
big or little endian
?

Claudio Bisegni

unread,
Apr 20, 2012, 6:22:37 PM4/20/12
to bs...@googlegroups.com
I use the ts-7800 sbc it's an armel so little-endian with eabi gcc.

Saluti
     Claudio

Dwight Merriman

unread,
Apr 21, 2012, 11:26:44 AM4/21/12
to bs...@googlegroups.com
see bsontypes.h - type 2 is string
so you are probably tring to pull a string from a bosnelement
yet it isn't a string

you could do something like

  cout << myelement.type();

to see what it is.

Bisegni Claudio

unread,
Apr 21, 2012, 3:25:00 PM4/21/12
to bs...@googlegroups.com
hi,
i have tested and it return:  type 0 so, somenthing goes wrong on insert of the string

Dwight Merriman

unread,
Apr 22, 2012, 1:16:25 PM4/22/12
to bs...@googlegroups.com
that means there is no such element

test the following code with your compilation let me know if it works:

{
 BSONObjBuilder b;
 b.append("x","y");
 cout << b.obj()["x"].String();

Bisegni Claudio

unread,
Apr 22, 2012, 3:56:43 PM4/22/12
to bs...@googlegroups.com
hi,
i have tryed and i receive the same error:

terminate called after throwing an instance of 'bson::assertion'
what(): BsonAssertion id: 13111 field not found, expected type 2
0Aborted

where i can put some output debug string to debug this issue on arm?

thank sin advance

Dwight Merriman

unread,
Apr 24, 2012, 12:54:51 PM4/24/12
to bs...@googlegroups.com
cout << b.obj().toString() << endl;

post that here?

Claudio Bisegni

unread,
Apr 24, 2012, 1:03:27 PM4/24/12
to bs...@googlegroups.com
hi,
here is the output:
0assertion failure in bson library: 10330 Element extends past end of object

terminate called after throwing an instance of 'bson::assertion'
what(): BsonAssertion id: 10330 Element extends past end of object
Aborted

for the main.cpp
int main (int argc, char* argv[] )
{
bson::BSONObjBuilder b;


b.append("x","y");

std::cout << b.obj().toString() << std::endl;
return 0;
}


thanks in advanced

Dwight Merriman

unread,
Apr 24, 2012, 1:44:57 PM4/24/12
to bs...@googlegroups.com
i'm out of ideas without digging in and debugging fully
sorry
run in debugger?
dump the byte output and see if it matches what non-arm generates?

Claudio Bisegni

unread,
May 18, 2012, 10:33:24 AM5/18/12
to bs...@googlegroups.com
Hi,
with a my coworker, we had debugged the bson source code on our arm board. The problem is the gcc and byte write alignment. But i have no idea how resolve it.
The problem appear on:

 void appendNum(int j) {
int* tmpPtr = (int*)grow(sizeof(int));
             *tmpPtr = j;
        }

if the tmpPtr point to a location inside the boundary of a word(4 byte), the write begin always ah the first byte of the involved word.
Someone have some hint to correct this?

thanks in advanced.

Il giorno martedì 24 aprile 2012 19:44:57 UTC+2, Dwight Merriman ha scritto:
i'm out of ideas without digging in and debugging fully
sorry
run in debugger?
dump the byte output and see if it matches what non-arm generates?
hi,

here is the output:
0assertion failure in bson library: 10330 Element extends past end of object
terminate called after throwing an instance of 'bson::assertion'
 what():  BsonAssertion id: 10330 Element extends past end of object
Aborted

for the main.cpp
int main (int argc, char* argv[] )
{
 bson::BSONObjBuilder b;
 b.append("x","y");
 std::cout << b.obj().toString() << std::endl;
return 0;
}


thanks in advanced
On 24/apr/2012, at 18:54, Dwight Merriman wrote:

> cout << b.obj().toString() << endl;
>
> post that here?
>

Reply all
Reply to author
Forward
0 new messages