User forums > Using Code::Blocks
GDB command
Jenna:
The commands are redirected.
To make visible what is sent and returned to and from gdb you have to check "Settings -> Compiler and debugger... -> Debugger settings -> Display debugger's log".
electrolot:
Thank you jens.
My debug log:
--- Code: ---Working dir : C:\Program Files\CodeBlocks\projects\arm_emul\
> set prompt >>>>>>cb_gdb:
(gdb)
>>>>>>cb_gdb:>>>>>>cb_gdb:
> show version
GNU gdb (Sourcery G++ Lite 2008q1-126) 6.7.50.20080107-cvs
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-mingw32 --target=arm-none-eabi".
For bug reporting instructions, please see:
<https://support.codesourcery.com/GNUToolchain/>.
>>>>>>cb_gdb:GNU gdb (Sourcery G++ Lite 2008q1-126) 6.7.50.20080107-cvs
> set confirm off
C
opyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-mingw32 --target=arm-none-eabi".
For bug reporting instructions, please see:
<https://support.codesourcery.com/GNUToolchain/>.
>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:>>>>>>cb_gdb:
> set debugevents on
No symbol "debugevents" in current context.
>>>>>>cb_gdb:>>>>>>cb_gdb:
> set new-console on
No symbol "debugevents" in current context.
No symbol "new" in current context.
>>>>>>cb_gdb:>>>>>>cb_gdb:
> set disassembly-flavor att
No symbol "new" in current context.
No symbol "disassembly" in current context.
>>>>>>cb_gdb:>>>>>>cb_gdb:
> catch throw
No symbol "disassembly" in current context.
Function "__cxa_throw" not defined.
>>>>>>cb_gdb:>>>>>>cb_gdb:
> cd bin/Debug
Function "__cxa_throw" not defined.
>>>>>>cb_gdb:>>>>>>cb_gdb:
> directory C:/PROGRA~1/CODEBL~1/projects/arm_emul/
>>>>>>cb_gdb:>>>>>>cb_gdb:
> target sim
Connected to the simulator.
>>>>>>cb_gdb:
> break "C:/Program Files/CodeBlocks/projects/arm_emul/main.c:11"
No source file named C:/Program Files/CodeBlocks/projects/arm_emul/main.c.
Connected to the simulator.
>>>>>>cb_gdb:Breakpoint 1 ("C:/Program Files/CodeBlocks/projects/arm_emul/main.c:11) pending.
> run
No source file named C:/Program Files/CodeBlocks/projects/arm_emul/main.c.
>>>>>>cb_gdb:Breakpoint 2 ("C:/Program Files/CodeBlocks/projects/arm_emul/main.c:11) pending.
>>>>>>cb_gdb:
warning: No program loaded.
--- End code ---
File C:/Program Files/CodeBlocks/projects/arm_emul/main.c exist.
Is it problem with Linux path ("/") ?
mariocup:
Hi electrolot,
please try to put your files in a path without spaces and then tell me if the problem still occurs. I had some time ago similar problems, since gdb tries to change to the pwd and then load the symbols e.g. with the absolute path.
Bye,
Mario
electrolot:
Hi Mario,
I put files in a path without spaces and my last problem does not exist. But I have few new problems with GDB output parsing by C::B. I've got very simple program:
--- Code: ---#include <stdio.h>
int i,j;
main (void)
{
int k;
printf("Hello World!\n");
while (1)
{
for (i=0;i<100;i++)
{
j++;
k+=2;
}
}
return 0;
}
--- End code ---
I can run my program in debugger, set breakpoint, stepping etc. My new problems:
1) Watch does not work propertly. I add to watch i,j variable, i value does not show, "j = type = int". Local variables is empty. Function arguments is k = 102.
Debug log after next line command:
--- Code: ---> next
Breakpoint 1, main () at main.c:12
c:/projects/arm_emul/main.c:12:145:beg:0x144
>>>>>>cb_gdb:c:/projects/arm_emul/main.c:13:161:beg:0x158
> info locals
>>>>>>cb_gdb:
> info args
k = 102
>>>>>>cb_gdb:k = 102
> whatis i
>>>>>>cb_gdb:No arguments.
> output i
>>>>>>cb_gdb:No arguments.
> whatis j
>>>>>>cb_gdb:
> output j
type = int
>>>>>>cb_gdb:type = int
>>>>>>cb_gdb:51>>>>>>cb_gdb:51>>>>>>cb_gdb:type = int
>>>>>>cb_gdb:type = int
>>>>>>cb_gdb:52>>>>>>cb_gdb:52>>>>>>cb_gdb:
--- End code ---
2) disassembly does not work. I still see "Please wait while disassembling..."
Debug log:
--- Code: ---> info frame
Stack level 0, frame at 0x200000:
pc = 0x134 in main (main.c:10); saved pc 0x2cb4
source language c.
Arglist at 0x1ffff0, args:
Locals at 0x1ffff0, Previous frame's sp is 0x200000
Saved registers:
r11 at 0x1ffff8, lr at 0x1ffffc, pc at 0x1ffffc
>>>>>>cb_gdb:Stack level 0, frame at 0x200000:
> disassemble
pc = 0x134 in main (main.c:10); saved pc 0x2cb4
source language c.
Arglist at 0x1ffff0, args:
Locals at 0x1ffff0, Previous frame's sp is 0x200000
Saved registers:
r11 at 0x1ffff8, lr at 0x1ffffc, pc at 0x1ffffc
>>>>>>cb_gdb:
Dump of assembler code for function main:
0x00000120 <main+0>: push {r11, lr}
0x00000124 <main+4>: add r11, sp, #4 ; 0x4
0x00000128 <main+8>: sub sp, sp, #8 ; 0x8
0x0000012c <main+12>: ldr r0, [pc, #88] ; 0x18c <main+108>
0x00000130 <main+16>: bl 0x260 <puts>
0x00000134 <main+20>: ldr r2, [pc, #84] ; 0x190 <main+112>
0x00000138 <main+24>: mov r3, #0 ; 0x0
0x0000013c <main+28>: str r3, [r2]
0x00000140 <main+32>: b 0x178 <main+88>
0x00000144 <main+36>: ldr r3, [pc, #72] ; 0x194 <main+116>
0x00000148 <main+40>: ldr r3, [r3]
0x0000014c <main+44>: add r2, r3, #1 ; 0x1
0x00000150 <main+48>: ldr r3, [pc, #60] ; 0x194 <main+116>
0x00000154 <main+52>: str r2, [r3]
0x00000158 <main+56>: ldr r3, [r11, #-8]
0x0000015c <main+60>: add r3, r3, #2 ; 0x2
0x00000160 <main+64>: str r3, [r11, #-8]
0x00000164 <main+68>: ldr r3, [pc, #36] ; 0x190 <main+112>
0x00000168 <main+72>: ldr r3, [r3]
0x0000016c <main+76>: add r2, r3, #1 ; 0x1
0x00000170 <main+80>: ldr r3, [pc, #24] ; 0x190 <main+112>
0x00000174 <main+84>: str r2, [r3]
0x00000178 <main+88>: ldr r3, [pc, #16] ; 0x190 <main+112>
0x0000017c <main+92>: ldr r3, [r3]
0x00000180 <main+96>: cmp r3, #99 ; 0x63
0x00000184 <main+100>: ble 0x144 <main+36>
0x00000188 <main+104>: b 0x134 <main+20>
0x0000018c <main+108>: andeq r3, r0, r4, lsl r2
0x00000190 <main+112>: andeq r3, r0, r12, asr #21
0x00000194 <main+116>: ldrdeq r3, [r0], -r0
End of assembler dump.
>>>>>>cb_gdb:Dump of assembler code for function main:
0x00000120 <main+0>: push {r11, lr}
0x00000124 <main+4>: add r11, sp, #4 ; 0x4
0x00000128 <main+8>: sub sp, sp, #8 ; 0x8
0x0000012c <main+12>: ldr r0, [pc, #88] ; 0x18c <main+108>
0x00000130 <main+16>: bl 0x260 <puts>
0x00000134 <main+20>: ldr r2, [pc, #84] ; 0x190 <main+112>
0x00000138 <main+24>: mov r3, #0 ; 0x0
0x0000013c <main+28>: str r3, [r2]
0x00000140 <main+32>: b 0x178 <main+88>
0x00000144 <main+36>: ldr r3, [pc, #72] ; 0x194 <main+116>
0x00000148 <main+40>: ldr r3, [r3]
0x0000014c <main+44>: add r2, r3, #1 ; 0x1
0x00000150 <main+48>: ldr r3, [pc, #60] ; 0x194 <main+116>
0x00000154 <main+52>: str r2, [r3]
0x00000158 <main+56>: ldr r3, [r11, #-8]
0x0000015c <main+60>: add r3, r3, #2 ; 0x2
0x00000160 <main+64>: str r3, [r11, #-8]
0x00000164 <main+68>: ldr r3, [pc, #36] ; 0x190 <main+112>
0x00000168 <main+72>: ldr r3, [r3]
0x0000016c <main+76>: add r2, r3, #1 ; 0x1
0x00000170 <main+80>: ldr r3, [pc, #24] ; 0x190 <main+112>
0x00000174 <main+84>: str r2, [r3]
0x00000178 <main+88>: ldr r3, [pc, #16] ; 0x190 <main+112>
0x0000017c <main+92>: ldr r3, [r3]
0x00000180 <main+96>: cmp r3, #99 ; 0x63
0x00000184 <main+100>: ble 0x144 <main+36>
0x00000188 <main+104>: b 0x134 <main+20>
0x0000018c <main+108>: andeq r3, r0, r4, lsl r2
0x00000190 <main+112>: andeq r3, r0, r12, asr #21
0x00000194 <main+116>: ldrdeq r3, [r0], -r0
End of assembler dump.
>>>>>>cb_gdb:
--- End code ---
3) CPU registers refresh only first time. Next Line commands does not refresh values of registers.
mariocup:
Hi,
could you attach your C::B project file and then I will have a look at it.
Bye,
Mario
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version