@Notaz,
notify_gdb_of_libraries just fixed a lot of things for me - GDB is becoming usable now!
Progressed past previous issues, getting a crash later on, spent a while looking at it tonight, didn't manage to crack it, will need to have more of a think about it. I'll list the crash below with my understanding so far:
0018cb18 <_ZN6Social4Core5onLogEPKc>:
18cb18: e92d4038 push {r3, r4, r5, lr}
18cb1c: e1a05000 mov r5, r0
18cb20: e59f40cc ldr r4, [pc, #204] ; 18cbf4 <_ZN6Social4Core5onLogEPKc+0xdc>
18cb24: e59f30cc ldr r3, [pc, #204] ; 18cbf8 <_ZN6Social4Core5onLogEPKc+0xe0>
18cb28: e08f4004 add r4, pc, r4
18cb2c: e7943003 ldr r3, [r4, r3]
18cb30: e5933000 ldr r3, [r3]
18cb34: e3500000 cmp r0, #0
18cb38: 13530000 cmpne r3, #0
18cb3c: 1a000020 bne 18cbc4 <_ZN6Social4Core5onLogEPKc+0xac>
18cb40: e3500000 cmp r0, #0
18cb44: 0a000020 beq 18cbcc <_ZN6Social4Core5onLogEPKc+0xb4>
18cb48: ebfc66d7 bl a66ac <_GLOBAL__sub_I_GameStore.cpp-0xb14>
18cb4c: e59f30a8 ldr r3, [pc, #168] ; 18cbfc <_ZN6Social4Core5onLogEPKc+0xe4>
18cb50: e1a01005 mov r1, r5
18cb54: e7944003 ldr r4, [r4, r3]
18cb58: e1a02000 mov r2, r0
18cb5c: e1a00004 mov r0, r4
18cb60: eb02bdf7 bl 23c344 <_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i>
So this function, Social::Core:
nLog(char const*) calls into std::__ostream_insert (on last line) which then goes onto crash, I believe the reason for this is the first parameter (the output stream) is not valid. This is a normal function (not a member function), so r0 holds the stream pointer, following the dissassembly backwards, suggests the value for r0 is coming from:
18cb5c: r0 = r4
where r4 is:
18cb54: r4 = *( r4 + r3 )
where r3 is:
18cb4c: r3 = *(18cbfc) which is 0x00001064
and r4 is:
18cb20: r4 = *(18cbf4) which is 0x0011d0ec
18cb28: r4 += $PC (when $PC is 0x18cb28) so r4=0x2A9C14
so r4 becomes:
18cb54: r4 = *(0x00001064 + 0x2A9C14)
18cb54: r4 =*(0x2AAC78) which is 0x001105f0
I guess as it is a reference it'll be getting passed essentially as a pointer, so taking a look at 0x001105f0 shows me:
001105f0 <_ZN7CVectorIN14CSocialManager13SMassLifeGiftEEixEi>:
1105f0: e5903004 ldr r3, [r0, #4]
1105f4: e3a00018 mov r0, #24
1105f8: e0203190 mla r0, r0, r1, r3
1105fc: e12fff1e bx lr
If I demangle that, CVector:
perator[](int)
So, first of all, I believe I have probably made a mistake above (will look through it all again tomorrow), as it doesn't make too much sense to me that this would be getting passed through as an output stream. But second of all, is there a better way to track down these literals, without manually adding up a bunch of static addresses? And once the address has been found, one would imagine that the stream will be closed when the program starts, then at a later point it will attempt to open the stream and store the handle pointer into memory, can I see from the disassembly what writes to the memory location? On the PC, using OllyDgb I may well be able to track this down, but at the moment I'm just using assembly output from objdump, and I feel I am missing a more useful tool, something that will let me tie the above together. Find out what is meant to be opening this output stream, which is probably failing due to not knowing where to write to, fix the missing function and press on!
Sorry for the lengthy post (again)..!