Author Topic: debugging using codeblocks  (Read 11998 times)

Offline anandamu16

  • Multiple posting newcomer
  • *
  • Posts: 96
debugging using codeblocks
« on: March 22, 2017, 06:51:30 am »
Hi,

I am using GNU GCC Compiler for ARM Debugger and openOCD to flash write my program in Cortex M0+ based MCU. Flash write completed fine.
Commands like run, Next line, step in, step out works fine but as soon as I click on Step into instruction or disassembly debugger window, It crashed away.

Any idea? what is wrong?

Os: Windows; Codeblocks 16.01

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: debugging using codeblocks
« Reply #1 on: March 22, 2017, 04:23:53 pm »
The normal request is to post the debugger log on this type of questions.
I do NOT use the CB  debugger enough to know how to find the debugger log.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline raynebc

  • Almost regular
  • **
  • Posts: 217
Re: debugging using codeblocks
« Reply #2 on: March 22, 2017, 06:50:15 pm »
There's a "Debugger" tab in the log window.

Offline anandamu16

  • Multiple posting newcomer
  • *
  • Posts: 96
Re: debugging using codeblocks
« Reply #3 on: March 23, 2017, 12:09:59 pm »
Debugger Log
Code
Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: D:\xyz\ledtest\
Adding source dir: D:\xyz\ledtest\
Adding file: D:\xyz\ledtest\bin\Debug\ledtest.elf
Changing directory to: D:/xyz/ledtest/.
Set variable: PATH=.;D:\usr\arm-none-eabi\lib;C:\Program Files (x86)\GNU Tools ARM Embedded\6.2 2016q4\bin;C:\Program Files (x86)\GNU Tools ARM Embedded\6.2 2016q4;C:\MinGW\bin;C:\MinGW;C:\ProgramData\Oracle\Java\javapath;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\doxygen\bin;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\SEGGER\JLink_V610l;C:\GNU_Tools_ARM_Embedded\6.2_2016q4\bin;C:\arm-none-eabi-gcc-4.8.2_nl-1.19.0_bu-2.23.2-mingw32-netx.0\arm-none-eabi-gcc-4.8.2\arm-none-eabi\bin;C:\arm-none-eabi-gcc-4.8.2_nl-1.19.0_bu-2.23.2-mingw32-netx.0\arm-none-eabi-gcc-4.8.2\bin;C:\gcc-arm-none-eabi-6_2-2016q4-20161216-win32\arm-none-eabi\bin;C:\gcc-arm-none-eabi-6_2-2016q4-20161216-win32\bin;C:\SysGCC\arm-elf\bin;C:\SysGCC\arm-eabi\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\TDM-GCC-32\bin;C:\Program Files (x86)\WinRAR;C:\Program Files (x86)\Subversion\bin;C:\Program Files (x86)\GNU Tools ARM Embedded\5.4 2016q3\bin;C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\arm\bin;C:\Program Files\Git\bin;C:\cygwin64\bin;C:\codeblocks zip\zip300xn-x64\zip300xn-x64;D:\nebo\openocd\openocd\inst\bin;C:\Program Files\SDCC\bin

[debug]Command-line: C:\Program Files (x86)\GNU Tools ARM Embedded\6.2 2016q4\bin\arm-none-eabi-gdb.exe -nx -fullname -quiet  -args D:/xyz/ledtest/bin/Debug/ledtest.elf
[debug]Working dir : D:\xyz\ledtest

Starting debugger: C:\Program Files (x86)\GNU Tools ARM Embedded\6.2 2016q4\bin\arm-none-eabi-gdb.exe -nx -fullname -quiet  -args D:/xyz/ledtest/bin/Debug/ledtest.elf
done

[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints

[debug]Reading symbols from D:/xyz/ledtest.elf...done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GNU Tools for ARM Embedded Processors) 7.12.0.20161204-git
[debug]Copyright (C) 2016 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GNU Tools for ARM Embedded Processors) 7.12.0.20161204-git

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 200
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]No symbol "new" in current context.
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]No symbol "disassembly" in current context.
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\Program Files (x86)\CodeBlocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory D:/xyz/ledtest/
[debug]Source directories searched: D:/xyz/ledtest;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> target extended-remote  | D:/nebo/openocd/openocd/inst/bin/openocd.exe -p -d3 -l openocd.log -f D:/nebo/openocd/openocd/tcl/board/axm0_axdbg.cfg
[debug]Open On-Chip Debugger 0.10.0+dev-g377b179-dirty (2017-03-15-18:07)
[debug]Licensed under GNU GPL v2
[debug]For bug reports, read
[debug] http://openocd.org/doc/doxygen/bugs.html
[debug]Remote debugging using | D:/nebo/openocd/openocd/inst/bin/openocd.exe -p -d3 -l openocd.log -f D:/nebo/openocd/openocd/tcl/board/axm0_axdbg.cfg
[debug]0x00000000 in __isr_vector ()
[debug]>>>>>>cb_gdb:
[debug]> monitor halt

In __isr_vector () ()

[debug]> monitor halt
[debug]target halted due to debug-request, current mode: Thread
[debug]xPSR: 0x21000000 pc: 0x00000112 msp: 0x20001fe0
[debug]>>>>>>cb_gdb:
[debug]> load ./bin/Debug/ledtest.elf
[debug]>>>>>>cb_gdb:
[debug]> file ./bin/Debug/ledtest.elf
[debug]Loading section .text, size 0x4de lma 0x0
[debug]Start address 0xa0, load size 1246
[debug]Transfer rate: 40 KB/sec, 1246 bytes/write.
[debug]>>>>>>cb_gdb:Reading symbols from ./bin/Debug/ledtest.elf...done.
[debug]> monitor reset
[debug]>>>>>>cb_gdb:
[debug]> monitor halt
[debug]SWD DPIDR 0x0bc11477
[debug]>>>>>>cb_gdb:
[debug]> monitor flash erase_address 0x0 0x10000
[debug]target halted due to debug-request, current mode: Thread
[debug]xPSR: 0x21000000 pc: 0x00000112 msp: 0x20001fd0
[debug]>>>>>>cb_gdb:
[debug]> monitor flash write_bank 0 D:/xyz/ledtest.bin 0
[debug]detected part: axm0 Orion - Rev: 1
[debug]flash size = 64kbytes
[debug]flash page size = 512bytes
[debug]erased address 0x00000000 (length 65536) in 0.920000s (69.565 KiB/s)
[debug]odd number of bytes to write (1246), extending to 1248 and padding with 0xff
[debug]>>>>>>cb_gdb:
[debug]> break "D:/xyz/ledtest/src/testled.c:46"
[debug]wrote 1246 bytes from file D:/xyz/ledtest.bin to flash bank 0 at offset 0x00000000 in 0.050000s (24.336 KiB/s)
[debug]>>>>>>cb_gdb:

wrote 1246 bytes from file D:/xyz/ledtest.bin to flash bank 0 at offset 0x00000000 in 0.050000s (24.336 KiB/s)

[debug]> break "D:/xyz/ledtest/src/testled.c:28"
[debug]Breakpoint 2 at 0x1ac: file src\testled.c, line 46.
[debug]>>>>>>cb_gdb:
[debug]> break "D:/xyz/ledtest/src/testled.c:178"
[debug]Breakpoint 3 at 0x130: file src\testled.c, line 28.
[debug]>>>>>>cb_gdb:
[debug]> bt 30
[debug]Breakpoint 4 at 0x484: file src\testled.c, line 178.
[debug]>>>>>>cb_gdb:#0  Reset_Handler () at src/startup_ARMCM0plus.S:83
[debug]>>>>>>cb_gdb:
[debug]> if 1
disassemble 0x00000000
info frame
end
[debug] >
[debug] > >


As soon as I open disassembly window, codeblocks crashed away (i.e; No more commands can be executed. One need to close arm-none-eabi-gdb.exe from Task manager) with the output debugger log message as
Quote
[debug]> if 1
disassemble 0x00000000
info frame
end
[debug] >
[debug] > >
However, all other windows except this works fine
« Last Edit: March 23, 2017, 12:13:18 pm by anandamu16 »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: debugging using codeblocks
« Reply #4 on: March 23, 2017, 09:10:15 pm »
What is this "if 1"? Have you set a condition on some of your breakpoints?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline anandamu16

  • Multiple posting newcomer
  • *
  • Posts: 96
Re: debugging using codeblocks
« Reply #5 on: March 24, 2017, 05:03:44 am »
Quote
What is this "if 1"? Have you set a condition on some of your breakpoints?
No, I haven't set any condition on breakpoint.

Quote
[debug]> if 1
disassemble 0x00000000
info frame
end
[debug] >
[debug] > >
This is the output at debugger log. It occurs whenever I tried to open disassembly window on Codeblocks.
After it, debugger crashes and I need to close gdb from task manager.( as debugger didn't closed from codeblocks toolbar icons)

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: debugging using codeblocks
« Reply #6 on: March 24, 2017, 05:51:08 am »
That "if 1" seems to be coming from GdbCmd_DisassemblyInit so i assume the version of arm-none-eabi-gdb.exe might not be completely compatible with CodeBlocks' gdb support.

Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline anandamu16

  • Multiple posting newcomer
  • *
  • Posts: 96
Re: debugging using codeblocks
« Reply #7 on: March 24, 2017, 07:23:46 am »
Hey Thanks.
 Previously I was using "C:\Program Files (x86)\GNU Tools ARM Embedded\6.2 2016q4\bin\arm-none-eabi-gdb.exe", Disassembly window was crashing up. On using"C:\Program Files (x86)\GNU Tools ARM Embedded\5.4 2016q3\bin\arm-none-eabi-gdb.exe", Disassembly window works fine.

Any idea, why it was not supporting disassembly previously? Moreover If you know which is the stable release of arm-none-eabi-gdb to be worked with codeblocks?

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: debugging using codeblocks
« Reply #8 on: March 24, 2017, 09:20:57 am »
Sorry I don't have experience with that toolset or compiler. I just looked up and examined the code that generated that "if 1" statement and saw that there is possibly a communication-error between codeblocks and that gdb.exe application.

I hope you understand that there is no army of developers following up every version of gdb and fix that for codeblocks...

Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib