GDB Printers Use string instead of char array

Ralf Habacker ralf.habacker at freenet.de
Thu Jul 29 14:36:08 BST 2021


Am 29.07.21 um 14:22 schrieb Da Viper via Kde-finance-apps:
>
> How do you check that the position is in 1 instead of 2 in  i586 
> architecture

The sizeof on an int type is 4 bytes on i586 and x86_64, while a pointer 
on x86_64 has 8 bytes size

see https://stackoverflow.com/a/30657693

Therefore on 32bit architecture the address offsets are

0  m_string
4  m_position  (index 1)
8  m_size

and on x86_64 they are

0  m_string
8  m_position (index 2)
12  m_size

With python you can estimate the target archicture for example by using 
the following code fragment https://stackoverflow.com/a/33222010.

Regards
Ralf



More information about the Kde-finance-apps mailing list