At first glance, the behavior you describe might indicate missing debug symbols in GDB. You can easily verify whether debug symbols are loaded, by inspecting the "attach" debug configuration you use. You should have the "Load symbols" checkbox ticked under the Startup tab. Moreover, the "gdb traces" console must contain the "symbol-file" command. Note that you'll need the elf/axf file with unstripped debug symbols.
One other thing you can check is that the code from your elf file is placed in flash (e.g. 0x600xxxxx). Use Image Info view to analyze the elf or manually disassemble it and then double-check the location of .text section.
If the above suggestions won't help you solve the problem, it would be helpful if you could attach the GDB traces log.
Greetings,
MCUXpresso IDE Support