You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

编译Graphviz 2.34.0后GDB调试断点失效及步进异常问题求助

Debugging Graphviz 2.34.0 with GDB: Fixing Missing Breakpoints and Library Loading Issues

Looks like your core problem is that GDB is loading the system-installed Graphviz shared libraries (/usr/lib/libgvc.so.6, /usr/lib/libcgraph.so.6) instead of the version you compiled from source. These system libraries don't include debugging symbols, which explains why GDB can't find your source files (input.c, grammar.c) and your breakpoints fail to attach. Let's walk through the fixes step by step:

1. Recompile Graphviz with Full Debug Symbols

First, you need to ensure your build generates debug information (without optimizations that strip debug data):

# Clean up previous build artifacts
make clean

# Configure with debug flags enabled
../graphviz-2.34.0/configure --enable-debug CFLAGS="-g -O0" CXXFLAGS="-g -O0"

# Rebuild
make

The -g flag adds debug symbols, and -O0 disables compiler optimizations (which can warp line numbers and make debugging harder).

2. Force GDB to Load Your Local Compiled Libraries

By default, the system's library path takes precedence. You need to tell GDB to use your local build's libraries first:

Option A: Use LD_LIBRARY_PATH When Launching GDB

Point the library path to the .libs directories where your compiled libraries live (adjust the paths to match your actual build structure):

LD_LIBRARY_PATH=./build2/lib/.libs/:./build2/lib/cgraph/.libs/:./build2/lib/common/.libs/ \
gdb -x ./gdbCommands.txt --args ./build2/cmd/dot/.libs/dot -Tjpeg -oInput.jpeg Input.txt

Option B: Set Library Search Path Inside GDB

If you prefer to configure this after launching GDB, run:

set solib-search-path ./build2/lib/.libs/:./build2/lib/cgraph/.libs/:./build2/lib/common/.libs/

This tells GDB to prioritize your local libraries over system ones.

3. Verify Correct Library Loading

After launching GDB, run info sharedlibrary to confirm:

  • The paths for libgvc.so.6 and libcgraph.so.6 point to your build2 directory, not /usr/lib/
  • The Syms Read column shows Yes (not Yes (*)), meaning debug symbols are loaded successfully

4. Fixing Breakpoint Issues

Once the correct libraries are loaded with debug symbols:

  • Your existing breakpoints (break input.c:570, break grammar.c:1281) should attach without the "No source file named..." error
  • Double-check that the dir commands in your GDB script point to the correct source directories (confirm input.c exists in /home/oren/GIT/klee/benchmarks/graphviz/graphviz-2.34.0/lib/cgraph and grammar.c is in the path you specified)

5. Notes on Static Compilation

Your earlier --disable-shared attempt failed because static builds require all dependencies to be available as static libraries, which can be tricky for Graphviz's complex dependencies. For debugging, dynamic libraries are generally easier to work with—stick with the dynamic build fixes above unless you have a specific need for static compilation.

内容的提问来源于stack exchange,提问作者OrenIshShalom

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:22:48