Intellij-rust: GDB debug formatters not working

Created on 27 Mar 2019  路  3Comments  路  Source: intellij-rust/intellij-rust

Environment

  • Intellij-Rust plugin version: v0.2.95.2120-183
  • Rust toolchain version: rustc 1.33.0 (2aa4c46cf 2019-02-28)
  • IDE name and version: CLion 2018.3.4
  • Operating system: Arch Linux 5.0.4

Problem description

When debugging with GDB, formatters for all non-primitive types seem to be non-functional. When using LLDB, the formatters seem to work properly.

GDB (System, v8.2.1):
Screenshot

LLDB (Bundled, v6.0.0):
Screenshot

The following message is printed to the console when using GDB, leading me to believe it's an issue with my setup:

Error during pretty printers setup: Error while executing Python code.

Some features and performance optimizations will not be available.

Steps to reproduce

In a new binary project, paste the following code and set a breakpoint on the println line, then debug it with GDB:

use std::sync::Arc;

fn main() {
    let int = 10;
    let bool = true;
    let vec = vec![1, 2, 3, 4];
    let arc = Arc::new(5);
    let boxed = Box::new(6);
    let string = String::from("abc");
    let option = Some(7);

    println!("breakpoint here");
}
bug debugger

Most helpful comment

Doing some deeper digging, I found this in the logs:

2019-03-27 11:37:18,415 [ 871466]   INFO - brains.cidr.execution.debugger - Debugger started 
2019-03-27 11:37:18,514 [ 871565]   WARN - brains.cidr.execution.debugger - >python import sys; sys.dont_write_bytecode = True; sys.path.insert(0, "/opt/clion/bin/gdb/renderers"); from default.printers import register_default_printers; register_default_printers(None); from default.libstdcxx_printers import patch_libstdcxx_printers_module; patch_libstdcxx_printers_module(); from libstdcxx.v6.printers import register_libstdcxx_printers; register_libstdcxx_printers(None);  
2019-03-27 11:37:18,514 [ 871565]   WARN - brains.cidr.execution.debugger - <^error,msg="Error while executing Python code." 
2019-03-27 11:37:18,514 [ 871565]   WARN - brains.cidr.execution.debugger - Error during pretty printers setup: Error while executing Python code.

Some features and performance optimizations will not be available. 
com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$GDBCommandException: Error while executing Python code.
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$Response.createGDBError(GDBDriver.java:3089)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$Communication.waitFor(GDBDriver.java:2544)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.sendSilentRequestAndWaitForDone(GDBDriver.java:2350)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.c(GDBDriver.java:406)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.a(GDBDriver.java:517)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$VoidCommand.call(GDBDriver.java:2902)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$4.call(GDBDriver.java:499)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$4.call(GDBDriver.java:494)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.a(GDBDriver.java:2878)
    at com.jetbrains.cidr.execution.ExecutionQueueProcessor.a(ExecutionQueueProcessor.java:26)
    at com.jetbrains.cidr.execution.ExecutionQueueProcessor.a(ExecutionQueueProcessor.java:36)
    at com.intellij.util.concurrency.QueueProcessor$RunnableConsumer.consume(QueueProcessor.java:280)
    at com.intellij.util.concurrency.QueueProcessor$RunnableConsumer.consume(QueueProcessor.java:277)
    at com.intellij.util.concurrency.QueueProcessor.lambda$null$0(QueueProcessor.java:79)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:232)
    at com.intellij.util.concurrency.QueueProcessor.lambda$wrappingProcessor$1(QueueProcessor.java:79)
    at com.intellij.util.concurrency.QueueProcessor.lambda$null$3(QueueProcessor.java:212)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:232)
    at com.intellij.util.concurrency.QueueProcessor.lambda$startProcessing$4(QueueProcessor.java:212)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)

It seems that this issue is caused by the way CLion is packaged in the Arch Linux AUR: The package aur/clion includes the core CLion IDE, but not the bundled toolchains - I only have aur/clion and aur/clion-lldb installed, and am using the system binaries for GDB and other tools. This means the directory /opt/clion/bin/gdb/renderers doesn't exist, which is likely the cause of the error in the logs.

All 3 comments

Doing some deeper digging, I found this in the logs:

2019-03-27 11:37:18,415 [ 871466]   INFO - brains.cidr.execution.debugger - Debugger started 
2019-03-27 11:37:18,514 [ 871565]   WARN - brains.cidr.execution.debugger - >python import sys; sys.dont_write_bytecode = True; sys.path.insert(0, "/opt/clion/bin/gdb/renderers"); from default.printers import register_default_printers; register_default_printers(None); from default.libstdcxx_printers import patch_libstdcxx_printers_module; patch_libstdcxx_printers_module(); from libstdcxx.v6.printers import register_libstdcxx_printers; register_libstdcxx_printers(None);  
2019-03-27 11:37:18,514 [ 871565]   WARN - brains.cidr.execution.debugger - <^error,msg="Error while executing Python code." 
2019-03-27 11:37:18,514 [ 871565]   WARN - brains.cidr.execution.debugger - Error during pretty printers setup: Error while executing Python code.

Some features and performance optimizations will not be available. 
com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$GDBCommandException: Error while executing Python code.
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$Response.createGDBError(GDBDriver.java:3089)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$Communication.waitFor(GDBDriver.java:2544)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.sendSilentRequestAndWaitForDone(GDBDriver.java:2350)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.c(GDBDriver.java:406)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.a(GDBDriver.java:517)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$VoidCommand.call(GDBDriver.java:2902)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$4.call(GDBDriver.java:499)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$4.call(GDBDriver.java:494)
    at com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver.a(GDBDriver.java:2878)
    at com.jetbrains.cidr.execution.ExecutionQueueProcessor.a(ExecutionQueueProcessor.java:26)
    at com.jetbrains.cidr.execution.ExecutionQueueProcessor.a(ExecutionQueueProcessor.java:36)
    at com.intellij.util.concurrency.QueueProcessor$RunnableConsumer.consume(QueueProcessor.java:280)
    at com.intellij.util.concurrency.QueueProcessor$RunnableConsumer.consume(QueueProcessor.java:277)
    at com.intellij.util.concurrency.QueueProcessor.lambda$null$0(QueueProcessor.java:79)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:232)
    at com.intellij.util.concurrency.QueueProcessor.lambda$wrappingProcessor$1(QueueProcessor.java:79)
    at com.intellij.util.concurrency.QueueProcessor.lambda$null$3(QueueProcessor.java:212)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:232)
    at com.intellij.util.concurrency.QueueProcessor.lambda$startProcessing$4(QueueProcessor.java:212)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)

It seems that this issue is caused by the way CLion is packaged in the Arch Linux AUR: The package aur/clion includes the core CLion IDE, but not the bundled toolchains - I only have aur/clion and aur/clion-lldb installed, and am using the system binaries for GDB and other tools. This means the directory /opt/clion/bin/gdb/renderers doesn't exist, which is likely the cause of the error in the logs.

After installing the clion-gdb package, the error is gone from the console/log and the values are better formatted, although still not quite as nicely as with LLDB:

Screenshot

@dmarcuse Thanks for reporting and investigating the issue!

As for comparing LLDB and GDB: now CLion with GDB (even for C++) can show either summary (size in case of Vec) or children (elements in case of Vec). It is a bug and I hope it will be fixed in the future.

Also, you are welcome to suggest the Rust types that our formatters currently don't support via creating new issues for it!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Undin picture Undin  路  3Comments

SomeoneToIgnore picture SomeoneToIgnore  路  3Comments

stonenice picture stonenice  路  3Comments

ralfbiedert picture ralfbiedert  路  3Comments

evanjpw picture evanjpw  路  3Comments