1

I am working on some ARM disassembly. A file is being operated on:

0000e550  sub  r3, r11, #0x2d0
0000e554  mov  r0, r3        ; /tmp/MAC
0000e558  ldr  r1, = 0x9a60c ; 0xec04 (sub_e3a8 + 0x85c)
0000e55c  mov  r2, #0x8      ; std::basic_fstream<char,std::char_traits<char>>::basic_fstream(char const*,std::_Ios_Openmode)
0000e560  bl   _ZNSt13basic_fstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT ; std::basic_fstream<char, std::char_traits<char> >::basic_fstream(char const*, std::_Ios_Openmode)

r0 is "this", r1 is the path (/tmp/MAC) and r2 is the mode. As can be seen, the mode is 0x8.

The mode is "implementation defined" according to several sources. I haven't got specifics of the implementation unfortunately.

What is the typical implementation of this on ARM ?

2

You should try to find out which compiler/library is being used, then check the specs of that compiler.

Assuming it's gcc with libstdc++ (this is quite probable if you're on android; less probable on Windows RT), googling for "gcc libstd ios_base openmode" yields https://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-api-4.5/a00504.html, which tells it's defined in ios_base.h. Navigating there, you can find

00112   enum _Ios_Openmode 
00113     { 
00114       _S_app        = 1L << 0,
00115       _S_ate        = 1L << 1,
00116       _S_bin        = 1L << 2,
00117       _S_in         = 1L << 3,
00118       _S_out        = 1L << 4,
00119       _S_trunc      = 1L << 5,
00120       _S_ios_openmode_end = 1L << 16 
00121     };

and

static const openmode in =      _S_in;

so the open mode is probably in.

But, unless you find out which compiler was used, this a guess, and we can only help you guessing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.