Eclipse Neon debugger jumps to random rows

Hello,
I have a problem debugging a C program with Eclipse Neon and toradex GDB debugger.
I have copied the example and I have placed a breakpoint on a row.
The debugger stops at that row but if I press Step Into or Step Over to go to the next row (it is a simple assignment) the debugger goes to a random line which can be two rows above etc. if I repeat this debug several times and continue the Step Over process instead of going line by line and following the program flow it randomly jumps back etc. (even in the simple hello world program).

Also sometimes if I place a break point in a certain point it is never triggered while if I place it in a lice which is immediately below it it is triggered.

What should I do?
I followed all the instructions to configure Ubuntu and Eclipse Neon.

Best regards,
Marco

Hi Marco

Did you compile your binary with any optimization? (i.e. not with ‘-O0’)

Optimized code usually behaves exactly as you described. Assignments get optimized away, the execution is different ordered in C than in the final binary and so on.

Otherwise: What version of things are we talking about?

Max

Hello @max.tx, I think I have found the problem.
I do not know why, but if I put ${CFLAGS} -c in the Other flags of Miscellaneous of section of Cross GCC compiler these flags are added: -O2 -pipe -g -feliminate-unused-debug-types -c
where there is also this -O2 which causes the activation of some optiomizations.

I have done what it says here in STEP 13, in the blue note by adding -Og -pipe -g -feliminate-unused-debug-types -c instead of ${CFLAGS} -c and now it works!

Thank you!

Best regards,
Marco

Hi Marco

/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/7.3.0/real-ld: error: ./Utils/Gsm/GSM.o: requires unsupported dynamic reloc R_ARM_THM_MOVW_ABS_NC; recompile with -fPIC

What happens if you do what the compiler suggests? e.g. at ‘-fPIC’ to the options?

Alternatively you might try to use the bfd linker instead of the gold linker which you likely use. e.g. add ‘-fuse-ld=bfd’ to the options?

Max

P.S. It really (really!!!, I do support for some time …) helps the supporter if you specify what versions of things you are using.

Hello, I have solved it by changing the flags which I have reported in my answer above.
I am using the version of tools recommended by Toradex so:
ECLIPSE:
Version: Neon.3 Release (4.6.3)
Build id: 20170314-1500

UBUNTU 16.04

The problem of requires unsupported dynamic reloc R_ARM_THM_MOVW_ABS_NC; recompile with -fPIC appeared because for an unknow reason the linker had an option checked where it was instructed to create a shared library instead of an executable.

King regards,
Marco

hi Marco

Thanks for your Input. Perfect that it works.

The problem of requires unsupported dynamic reloc R_ARM_THM_MOVW_ABS_NC; recompile with -fPIC appeared because for an unknow reason the linker had an option checked where it was instructed to create a shared library instead of an executable.

Where did you got this Information? Could you provide a Link?

Thanks and best regards, Jaski

Hello, because I checked Eclipse IDE and in a window, there was a tick to a sentence where it says that it was compiling a shared library instead of an executable.

Thanks for you Input.