0

I have a C application running on embedded ARM M4; it works correctly.

I use Kinetis Design Studio, which uses gdb, as my debugger on Windows.

For most of my .obj, I can single-step the C source. However, for a few files, although I can use breakpoints, single-stepping the C source doesn't work: pressing Single-step causes debugger to act as if I pressed Run but the app is definitely not running.

But single-stepping the assembly, same .obj files, works correctly.

I use the same compile options for all .c

-x c -Wall -Werror -std=c99 -nostdlib -mthumb -mtune=cortex-m4 -mlittle-endian -Wdouble-promotion -DNDEBUG -fdata-sections -ffunction-sections -c -save-temps=obj -g3 -gdwarf-2

QUESTION

For some .obj, why do the breakpoints and assembly single-step work but not the source single-step?

Bob
  • 4,576
  • 7
  • 39
  • 107
  • are all the sources in the same directory, which `gdb` can 'see' – user3629249 Sep 04 '18 at 14:29
  • 1
    There will be a setting in the debugger somewhere "freeze/halt processor while single stepping". Freescale tools have a tendency to keep interrupts running while you are stepping with the debugger. Also, ensure that the watchdog isn't enabled. – Lundin Sep 04 '18 at 14:31
  • @Lundin if any of those were the problem, it would affect debugging in all files? – Bob Sep 04 '18 at 14:32
  • Yeah probably. Hmm... disable optimizations? – Lundin Sep 04 '18 at 14:34
  • 1
    `-g3` - you probably do not generate the debug information – 0___________ Sep 04 '18 at 14:44
  • @P__J__ `g3` is the most debugging info. And I can single-step in other files as I stated in my post . . . and I can set breakpoints as I stated in my post. – Bob Sep 04 '18 at 14:53
  • So maybe there is no generated code tberem – 0___________ Sep 04 '18 at 15:11
  • @P__J__ I can put a breakpoint and it works. How could there be no generated code? – Bob Sep 04 '18 at 15:23
  • @Lundin talked to PEMicro support and they don't have such a function available either GUI nor script. I have to manually toggle the bit that disables interrupts. – Bob Sep 04 '18 at 15:24
  • You have strange symptoms so I ask basic questions. I afraid only you can answer your question as it requires access to your computer – 0___________ Sep 04 '18 at 16:04
  • Show the *exact* compilation command in your question – Basile Starynkevitch Sep 06 '18 at 07:55

1 Answers1

0

You could provide some more information and what you tried so far. For example, what is the difference in those object files? Are it always the same? Do they have specific dependencies to non-user-code or are they non-user-code? What are you debugger-options? Based on that, I can just give basic advice:

-Check the correctness of your symbol file configuration / that they are in sync with the binary and loaded correctly.

-Be sure that there are no changes to the source code after compilation, so the IDE cannot falsely shows code that does not exist in you latest compilation (which is not debuggable).

-Consider to deactivate options like JustMyCode - depending on your environment (https://learn.microsoft.com/de-de/visualstudio/debugger/just-my-code?view=vs-2017)

-Check your debugger options

Dan
  • 61
  • 12