Problems debugging under Red Hat Linux 2.6.18 (old kernel)

I tried CLion on Red Had Linux with old kernel (2.6.18-308.4.1.el5 x86_64 GNU/Linux).
Bundled gdb is compiled for newer kernel, so I compiled gdb 7.8 with python support from sources.

Here is my linux info:
uname -a
Linux 2.6.18-308.4.1.el5 #1 SMP Wed Mar 28 01:54:56 EDT 2012 x86_64 GNU/Linux

Python info:
Python 2.7.1 (r271:86832, Jul 19 2014, 23:36:35)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2

JVM info:
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)


I can run Hello World application from CLion, but when I try to debug, it fails with following message in the log:

2015-02-02 17:04:49,710 [  27340]   INFO - brains.cidr.execution.debugger - Debugger started
2015-02-02 17:04:50,005 [  27635]   INFO - brains.cidr.execution.debugger - PARSER INPUT:=thread-group-added,id="i1"
2015-02-02 17:04:50,165 [  27795]   INFO - brains.cidr.execution.debugger - PARSER INPUT:~"GNU gdb (GDB) 7.8\n"
2015-02-02 17:04:50,169 [  27799]   INFO - brains.cidr.execution.debugger - PARSER INPUT:~"Copyright (C) 2014 Free Software Foundation, Inc.\n"
2015-02-02 17:04:50,173 [  27803]   INFO - brains.cidr.execution.debugger - PARSER INPUT:~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/license
2015-02-02 17:04:50,176 [  27806]   INFO - brains.cidr.execution.debugger - PARSER INPUT:~"This GDB was configured as \"x86_64-unknown-linux-gnu\".\nType \"s
2015-02-02 17:04:50,176 [  27806]   INFO - brains.cidr.execution.debugger - PARSER INPUT:~"\nFor bug reporting instructions, please see:\n"
2015-02-02 17:04:50,177 [  27807]   INFO - brains.cidr.execution.debugger - PARSER INPUT:~"<http://www.gnu.org/software/gdb/bugs/>.\n"
2015-02-02 17:04:50,177 [  27807]   INFO - brains.cidr.execution.debugger - PARSER INPUT:~"Find the GDB manual and other documentation resources online at:\n
2015-02-02 17:04:50,177 [  27807]   INFO - brains.cidr.execution.debugger - PARSER INPUT:~"For help, type \"help\".\n"
2015-02-02 17:04:50,189 [  27819]   INFO - brains.cidr.execution.debugger - PARSER INPUT:~"Type \"apropos word\" to search for commands related to \"word\".\
2015-02-02 17:04:50,189 [  27819]   INFO - brains.cidr.execution.debugger - PARSER INPUT:=cmd-param-changed,param="print pretty",value="on"
2015-02-02 17:04:50,193 [  27823]   INFO - brains.cidr.execution.debugger - PARSER INPUT:^done
2015-02-02 17:04:50,202 [  27832]   INFO - brains.cidr.execution.debugger - PARSER INPUT:^done
2015-02-02 17:04:50,205 [  27835]   INFO - brains.cidr.execution.debugger - PARSER INPUT:&"python\n"
2015-02-02 17:04:50,206 [  27836]   INFO - brains.cidr.execution.debugger - PARSER INPUT:~">"
2015-02-02 17:04:50,206 [  27836]   INFO - brains.cidr.execution.debugger - PARSER INPUT:~">"
2015-02-02 17:04:50,206 [  27836]   INFO - brains.cidr.execution.debugger - PARSER INPUT:~">"
2015-02-02 17:04:50,207 [  27837]   INFO - brains.cidr.execution.debugger - PARSER INPUT:~">"
2015-02-02 17:04:50,207 [  27837]   INFO - brains.cidr.execution.debugger - PARSER INPUT:^done
2015-02-02 17:04:50,216 [  27846]   INFO - brains.cidr.execution.debugger - PARSER INPUT:^done
2015-02-02 17:04:50,220 [  27850]   INFO - brains.cidr.execution.debugger - PARSER INPUT:^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",add
2015-02-02 17:04:50,244 [  27874]   INFO - brains.cidr.execution.debugger - PARSER INPUT:^done
2015-02-02 17:04:50,263 [  27893]   INFO - brains.cidr.execution.debugger - PARSER INPUT:^done
2015-02-02 17:04:50,281 [  27911]   INFO - brains.cidr.execution.debugger - PARSER INPUT:=thread-group-started,id="i1",pid="2324"
2015-02-02 17:04:50,287 [  27917]   INFO - brains.cidr.execution.debugger - PARSER INPUT:=thread-created,id="1",group-id="i1"
2015-02-02 17:04:50,391 [  28021]   INFO - brains.cidr.execution.debugger - PARSER INPUT:=thread-exited,id="1",group-id="i1"
2015-02-02 17:04:50,398 [  28028]   INFO - brains.cidr.execution.debugger - PARSER INPUT:=thread-group-exited,id="i1"
2015-02-02 17:04:50,405 [  28035]   INFO - brains.cidr.execution.debugger - PARSER INPUT:^error,msg="During startup program exited with code 1."
2015-02-02 17:04:50,406 [  28036]   WARN - brains.cidr.execution.debugger - >-exec-run
2015-02-02 17:04:50,407 [  28037]   WARN - brains.cidr.execution.debugger - <^error,msg="During startup program exited with code 1."
2015-02-02 17:04:50,423 [  28053]   WARN - brains.cidr.execution.debugger - During startup program exited with code 1.
com.intellij.execution.ExecutionException: During startup program exited with code 1.
        at com.jetbrains.cidr.execution.ExecutionResult.get(ExecutionResult.java:51)
        at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.a(GDBDriver.java:1888)
        at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.a(GDBDriver.java:1883)
        at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.launch(GDBDriver.java:414)
        at com.jetbrains.cidr.execution.debugger.CidrDebugProcess.doLaunchTarget(CidrDebugProcess.java:433)
        at com.jetbrains.cidr.execution.debugger.CidrDebugProcess$7.run(CidrDebugProcess.java:423)
        at com.jetbrains.cidr.execution.debugger.CidrDebugProcess$MyCommandProcessor.consume(CidrDebugProcess.java:679)
        at com.jetbrains.cidr.execution.debugger.CidrDebugProcess$MyCommandProcessor.consume(CidrDebugProcess.java:672)
        at com.intellij.util.concurrency.QueueProcessor$2$1.run(QueueProcessor.java:110)
        at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
        at com.intellij.util.concurrency.QueueProcessor$2.consume(QueueProcessor.java:107)
        at com.intellij.util.concurrency.QueueProcessor$2.consume(QueueProcessor.java:104)
        at com.intellij.util.concurrency.QueueProcessor$3$1.run(QueueProcessor.java:215)
        at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
        at com.intellij.util.concurrency.QueueProcessor$3.run(QueueProcessor.java:212)
        at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:408)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
        at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)

Caused by: com.jetbrains.cidr.execution.debugger.backend.gdb.GDBCommandException: During startup program exited with code 1.
        at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.b(GDBDriver.java:1594)
        at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.b(GDBDriver.java:1586)
        at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.a(GDBDriver.java:1539)
        at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.a(GDBDriver.java:1530)
        at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.access$1400(GDBDriver.java:37)
        at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$7.run(GDBDriver.java:486)
        at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$33.run(GDBDriver.java:1915)
        at com.intellij.util.concurrency.QueueProcessor$RunnableConsumer.consume(QueueProcessor.java:298)
        at com.intellij.util.concurrency.QueueProcessor$RunnableConsumer.consume(QueueProcessor.java:295)
        ... 15 more
2015-02-02 17:04:50,434 [  28064]   INFO - brains.cidr.execution.debugger - PARSER INPUT:&"The program is not being run.\n"
2015-02-02 17:04:50,435 [  28065]   INFO - brains.cidr.execution.debugger - PARSER INPUT:^error,msg="The program is not being run."
2015-02-02 17:04:50,435 [  28065]   WARN - brains.cidr.execution.debugger - >-interpreter-exec console "signal 6"
2015-02-02 17:04:50,435 [  28065]   WARN - brains.cidr.execution.debugger - <^error,msg="The program is not being run."
2015-02-02 17:04:50,446 [  28076]   INFO - brains.cidr.execution.debugger - Debugger exited with code 139
2015-02-02 17:07:38,117 [ 195747]   INFO - org.jetbrains.io.BuiltInServer - web server stopped

Could you please suggest what can I do to troubleshoot/fix this?

7 comments
Comment actions Permalink

Hi,

Have you tried debugging this "Hello world" binary with your gdb build directly, without CLion?

0
Comment actions Permalink

Yes, I run both gdb 7.8 and 7.8.2 (and tried both in CLion).

Here is output:

abasko@server0-lnx[16]% ~/opt/gdb-7.8.2/bin/gdb ~/.clion10/system/cmake/generated/db7cfeb8/db7cfeb8/Debug/untitled
GNU gdb (GDB) 7.8.2
Copyright (C) 2014 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 "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /model/home/abasko/.clion10/system/cmake/generated/db7cfeb8/db7cfeb8/Debug/untitled...done.
(gdb) br main
Breakpoint 1 at 0x400a6a: file /model/home/abasko/ClionProjects/untitled/main.cpp, line 6.
(gdb) r
Starting program: /model/home/abasko/.clion10/system/cmake/generated/db7cfeb8/db7cfeb8/Debug/untitled

Breakpoint 1, main () at /model/home/abasko/ClionProjects/untitled/main.cpp:6
6           cout << "Hello, World!" << endl;
(gdb) c
Continuing.
Hello, World!
[Inferior 1 (process 30050) exited normally]
(gdb) quit

abasko@server0-lnx[17]% ~/opt/gdb-7.8/bin/gdb ~/.clion10/system/cmake/generated/db7cfeb8/db7cfeb8/Debug/untitled
GNU gdb (GDB) 7.8
Copyright (C) 2014 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 "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /model/home/abasko/.clion10/system/cmake/generated/db7cfeb8/db7cfeb8/Debug/untitled...done.
(gdb) br main
Breakpoint 1 at 0x400a6a: file /model/home/abasko/ClionProjects/untitled/main.cpp, line 6.
(gdb) r
Starting program: /model/home/abasko/.clion10/system/cmake/generated/db7cfeb8/db7cfeb8/Debug/untitled
Can't read symbols from system-supplied DSO at 0x2aaaaaaab000: File truncated

Breakpoint 1, main () at /model/home/abasko/ClionProjects/untitled/main.cpp:6
6           cout << "Hello, World!" << endl;
(gdb) c
Continuing.
Hello, World!
[Inferior 1 (process 30107) exited normally]
(gdb)



Here is my .gdbinit

set auto-load safe-path /
set print pretty on
python
import sys
sys.path.insert(0, '/model/home/abasko/pretty-print/2')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end

0
Comment actions Permalink

Could you remove (rename) your .gdbinit file and run the session once more (we actually have pretty printing scripts bundled with CLion and they are injected at startup).

0
Comment actions Permalink

I tried it already, doesn't help.

This is what I see in GDB window in CLion:

GNU gdb (GDB) 7.8.2
Copyright (C) 2014 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 "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
python
>>>>The program is not being run.


Is there a way to enable more logging so I could see input/output of GDB process?

0
Comment actions Permalink

Please, try to add #com.jetbrains.cidr.execution.debugger line to Help->Configure Debug Log Settings

0
Comment actions Permalink

Thanks, this helped. The problem was that CLion sent the following command to gdb :

-exec-arguments  1> "/tmp/___0out" 2> "/tmp/___0err"


And our default shell is csh, looks like it was failing because of that.
After I switched to bash, everything works like a charm! :)


Thank you!
0
Comment actions Permalink

Glad to hear that. However, it looks like a bug in CLion (https://youtrack.jetbrains.com/issue/CPP-2328)

0

Please sign in to leave a comment.