News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Problems debugging in Codeblocks

Started by Totoxa, February 05, 2012, 02:59:21 AM

Previous topic - Next topic

Totoxa

Hello, when i remove a breakpoint the debugger still stop where the breakpoint was set, to remove it i have to use the command bar, i use Ubuntu 10.04, Codeblocks 10.05 release and SVN, compiled by myself, what can be wrong? also when the debug process start the terminal show something like "GDB: failed to set controlling terminal.."

ollydbg

Suggestions:
1, You can try a "debugger branch", see:The 07 January 2012 build (7678) DEBUGGER BRANCH version is out.
2, Please post your debugger's log here. (check on the option: Display debugger's log in debugger setting dialog)


It looks like you have the same issue as me, see
Re: The 07 January 2012 build (7678) DEBUGGER BRANCH version is out. and the following discussion. (I have a workaround here).
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

oBFusCATed

Quote from: ollydbg on February 05, 2012, 09:25:11 AM
It looks like you have the same issue as me, see
Re: The 07 January 2012 build (7678) DEBUGGER BRANCH version is out. and the following discussion. (I have a workaround here).
No, in 10.05 or trunk setting breakpoints while the debuggee is running just doesn't work.
Your problem is way more complex.
(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!]

Totoxa


Breakpoint 2, getfamilypart::getparts (this=0x804d008, pic12=0x804d028, pic14=0x804d140, pic16=0x804d258, pic18=0x804d370, pic24=0x804d488, pic30=0x804d5a0, pic33=0x804d6b8) at /home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp:141
/home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp:141:3310:beg:0x8049589
>>>>>>cb_gdb:
> info locals
strlen = 9
partname = "PIC16F917\000d Part\000\367\377\277(\367\377\277\064\367\377\277\061\250-\000\230\371\377\267\000\000\000\000\vy-\000\000\000\000\000 \000\000\000\020\001\000\000T\367\377\277 \000\000\000\374\000\000\000\363\272\071\000\370\003<\000߹9\000ͼ9\000\060\000\000\000\000\001\000\000\b\215\023\000\n\273\071\000\300\003<\000\070\t\002\000\360\003<\000\364\357;\000\300\003<\000\000\000\000\000h\367\377\277\234\217-\000\363\272\071\000\370\003<\000߹9\000\364\277!\000\374\000\000\000\000\000\000\000\230\367\377\277\a\274\036\000\374\000\000\000P\t\002\000\360\003<\000\364\357;\000\300\003<\000\000\000\000\000\250\367\377\277\364\277!\000\000\000\000\000\000\000\000\000\270\367\377\277=\275\036\000\374\000\000\000\000\000\000\000\330\367\377\277\a\274\036\000)\275\036\000\270\326\004\b\330\367\377\277\f\214\004\b\374\000\000\000\060\062\022\000\001\000\000"
k = 2
fsize = 156449
internalId = 4992
tempoffset = 344
offset = 1775
>>>>>>cb_gdb:
> info args
this = 0x804d008
pic12 = 0x804d028
pic14 = 0x804d140
pic16 = 0x804d258
pic18 = 0x804d370
pic24 = 0x804d488
pic30 = 0x804d5a0
pic33 = 0x804d6b8
>>>>>>cb_gdb:
> break "/home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp:141"
Punto de interrupción 3 at 0x8049589: file /home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp, line 141.
>>>>>>cb_gdb:
> break "/home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp:141"
Punto de interrupción 4 at 0x8049589: file /home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp, line 141.
>>>>>>cb_gdb:
> break "/home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp:141"
Punto de interrupción 5 at 0x8049589: file /home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp, line 141.
>>>>>>cb_gdb:
> break "/home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp:141"
Punto de interrupción 6 at 0x8049589: file /home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp, line 141.
>>>>>>cb_gdb:
> break "/home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp:141"
Punto de interrupción 7 at 0x8049589: file /home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp, line 141.
>>>>>>cb_gdb:
> break "/home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp:141"
Punto de interrupción 8 at 0x8049589: file /home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp, line 141.
>>>>>>cb_gdb:
> break "/home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp:141"
Punto de interrupción 9 at 0x8049589: file /home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp, line 141.
>>>>>>cb_gdb:
> break "/home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp:141"
Punto de interrupción 10 at 0x8049589: file /home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp, line 141.
>>>>>>cb_gdb:
> break "/home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp:141"
Punto de interrupción 11 at 0x8049589: file /home/fabian/Escritorio/temp/pruebas/getfamilypart.cpp, line 141.


between each ">break" i was enabling and disabling the same breakpoint in the gui

oBFusCATed

1. This is not the debugger's branch
2. Don't use localized versions of gdb, it will break debugging 100% guaranteed.
(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!]

Totoxa

#5
I think that the reason of this is at the file "gdb_commands.h":


class GdbCmd_AddBreakpoint : public DebuggerCmd
{
       DebuggerBreakpoint* m_BP;
   public:
       /** @param bp The breakpoint to set. */
       GdbCmd_AddBreakpoint(DebuggerDriver* driver, DebuggerBreakpoint* bp)
           : DebuggerCmd(driver),
           m_BP(bp)
       {
           // gdb doesn't allow setting the bp number.
           // instead, we must read it back in ParseOutput()...
           m_BP->index = -1;


here the index of the breakpoint is set to -1, and it appears that it is never changed, so when the function "RemoveBreakpoint"

void GDB_driver::RemoveBreakpoint(DebuggerBreakpoint* bp)
{
   if (bp && bp->index != -1)
       QueueCommand(new GdbCmd_RemoveBreakpoint(this, bp));
}

is called the breakpoint doesnt get removed. i dont know how to solve it(if it is the cause).

EDIT: OK, now i understand..., thanks

ollydbg

Quote from: oBFusCATed on February 05, 2012, 10:59:18 PM
2. Don't use localized versions of gdb, it will break debugging 100% guaranteed.
@Totoxa
The debugger plugin just parses the message returned from gdb command line, and sends some command also. So, if you use a localized gdb, it will definitely fail this handshake. So, please use an original (English language) gdb.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Totoxa

Quote from: ollydbg on February 06, 2012, 02:41:26 AM
Quote from: oBFusCATed on February 05, 2012, 10:59:18 PM
2. Don't use localized versions of gdb, it will break debugging 100% guaranteed.
@Totoxa
The debugger plugin just parses the message returned from gdb command line, and sends some command also. So, if you use a localized gdb, it will definitely fail this handshake. So, please use an original (English language) gdb.

Yes, yes, because that was the edit in my last post. thanks!

Totoxa

renaming the file /usr/share/locale-langpack/es/LC_MESSAGES/gdb.mo gdb display messages in english, so the problem has gone, thanks