Clion skips breakpoints on Arch.

I'm trying to write some code that converts int to an octal string.  If I'm working with char* at times the debugger won't stop. Everything will finish executing without throwing errors.

Here's the code in question:

 
#include "Itoo.h"
#include <iostream>
#include <tgmath.h>

void itoo(int value, char *str)
{
    int quotient;
    int
total = 0;
    int
i = 0;

    char
* p = str + std::size_t(str);
    
*--str = 0;
    while
(value && p > str)
    {
        *--str = '0' + (char)(value % 8);
        
value /= 8;
    
}
}

 
#include <iostream>
#include "Itoo.h"
#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main()
{
    int value = 16;
    char
*str = new char[2];
    
sprintf(str, "%o", value);
    
cout << str << endl;
    
str = nullptr;
    
str = new char[33];
    
itoo(value, str);
    
cout << str << endl;
    
cout << oct << 16 << endl;
    return 0;
}


I know the code needs some work to work correctly. I just can't stop at breakpoints. Even, if I just have the top half of main tilljust past sprintf break points are still skipped. If I remove all of the char* code I can stop at breakpoints. Is there a setting I need to configure?

9 comments
Comment actions Permalink

Alright, I had to go from GDB 7.8 to 7.10 to get my breakpoints to stop. I could probably roll the system back to 7.8. Could I also install 7.8 to another location? Even though, 7.10 is not supported would using it cause issues?

1
Comment actions Permalink

I have the same issue on Arch: CLion 1.2 with the default bundled GDB 7.8 skips breakpoints.

It is good to know that you have a small demo testcase for the issue, because mine is somewhere deep in a large project.

GDB 7.10 seems to break on the breakpoint, but communication between CLion and GDB seems unreliable: I got the "Command timed out" error as described here: http://blog.jetbrains.com/clion/2015/06/clion-1-0-4-update-fix-for-command-timed-out-problem/

:(

Let me know if you are aware of workarounds, e.g. if downgrading the system GDB can help!

Cheers
David

1
Comment actions Permalink

I'm pretty sure downgrading would help. I haven't had any issues since I switched to using 7.10 yet. Couldn't we just alias to 7.8 installed somewhere else?

0
Comment actions Permalink

I just built gdb 7.8 and installed it under /opt/gdb

Using it, CLion now stops at the breakpoint, but there is no indication where the debugger stands. "Frames" is empty, as is "Variables".

Using the custom-installed gdb 7.8 from the command line, gdb stops at the right place.

:(

Yours
David

0
Comment actions Permalink

Thanks for the info, odd that 7.10 is working fine for me for now. I'll try your solution, if I run into issues in the future.

0
Comment actions Permalink

I have the same problem with gdb 7.11. If only JetBrains fixed this...

1
Comment actions Permalink

I have this exact same issue in Ubuntu 14.04 with CLion 2016.2.3. The problem appears on both bundled GDB 7.11.1 and bundled LLDB 3.8.1. CLion just skips my breakpoints making the debugging functionality essentially absent. JetBrains, please fix this!!

1
Comment actions Permalink

It's been at least 5 months since the last comment here, but I was struggling with the problem myself and I fixed it. Before it started occuring, in Settings -> Build, Execution, Deployment, I changed the configuration from Debug to Default and that was my issue, so check if the configuration is anything besides Debug and make the necessary change.

 

My version of CLion is 2017.1 and GDB is 7.12.1

1
Comment actions Permalink

I had this problem and could not figure it out. In the end I just deleted the cmake-build-debug directory and reloaded the project and for some magic reasons break points started working again.

1

Please sign in to leave a comment.