AI-Powered Debugging & Compiler Analysis Tool with IBM BOB
A revolutionary compiler debugging and analysis tool that integrates IBM BOB (watsonx AI) with debuggers (GDB/LLDB) and compiler toolchains. Features autonomous debugging where AI takes complete control of debugging sessions, analyzes outputs, and provides comprehensive summaries.
- Hands-off debugging: IBM BOB automatically runs debugging commands
- AI-driven analysis: Analyzes each output and decides next steps
- Comprehensive summaries: Detailed reports with findings and recommendations
- Goal-oriented: Just specify what you want to find, BOB does the rest
- GDB & LLDB integration: Full debugger support
- Natural language commands: Chat with your debugger
- Real-time analysis: IBM BOB explains what's happening
- Session history: All debugging sessions saved for review
- LLVM IR generation: Generate and analyze intermediate representation
- Assembly analysis: Understand compiler output
- Optimization insights: See what passes were applied
- Binary analysis: nm, objdump, readelf, strings integration
- AI-powered test cases: Generate tests from descriptions
- Bug reproduction: Create test cases for customer issues
- Edge case generation: Comprehensive test coverage
# Clone the repository
git clone https://github.com/yourusername/CompilerCopilot.git
cd CompilerCopilot
# Run setup
./setup.sh
# Configure environment (interactive wizard)
./configure.shThe interactive configuration wizard will:
- Auto-detect installed tools (GDB, LLDB, Clang, etc.)
- Prompt for IBM watsonx credentials
- Validate your configuration
- Generate
.envfile
Or manually edit config/.env:
# IBM watsonx Configuration
IBM_BOB_API_KEY=your_api_key_here
IBM_BOB_PROJECT_ID=your_project_id_here
IBM_BOB_URL=https://us-south.ml.cloud.ibm.com
# Debugger Configuration
DEBUGGER_TYPE=gdb
GDB_PATH=/usr/bin/gdb
LLDB_PATH=/usr/bin/lldb
# Compiler Configuration
CLANG_PATH=/usr/bin/clang# Start Compiler Copilot
./compiler-copilot.sh
# Or activate virtual environment and run directly
source venv/bin/activate
python -m src.shell.interactive_v2copilot> autodebug ./myprogram "Find cause of segmentation fault"IBM BOB will:
- Start the debugger
- Run the program
- Analyze the crash
- Examine memory and registers
- Identify the root cause
- Provide fix recommendations
Output:
π€ AUTONOMOUS DEBUGGING SESSION STARTED
Session ID: debug_1717567890
Program: ./myprogram
Goal: Find cause of segmentation fault
π Step 1/50: Starting program...
π Step 2/50: Analyzing crash location...
π Step 3/50: Examining pointer values...
β
Goal achieved!
π SUMMARY:
- Segmentation fault at line 15
- NULL pointer dereference
- Pointer 'ptr' never initialized
π‘ RECOMMENDATIONS:
1. Initialize ptr: int *ptr = malloc(sizeof(int));
2. Add NULL check before use
3. Free memory after use
copilot> debug ./program
copilot> run
copilot> backtrace
copilot> print variable# Generate LLVM IR
copilot> generate ir main.c --opt O2
# Generate assembly
copilot> generate assembly main.c
# Analyze optimization passes
copilot> analyze ir main.c# Show symbols
copilot> nm ./program
# Disassemble
copilot> objdump ./program
# Show ELF info
copilot> readelf ./programcopilot> "Why is my program crashing?"
copilot> "Explain this assembly code"
copilot> "Generate a test case for buffer overflow"βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Interface β
β (Interactive Shell / Chat) β
βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β IBM BOB (watsonx AI) β
β β’ Command Interpretation β
β β’ Output Analysis β
β β’ Decision Making β
β β’ Summary Generation β
βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββ΄ββββββββββ¬ββββββββββββββ
βΌ βΌ βΌ
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β Debuggers β β Compiler β β Binary β
β GDB/LLDB β β Clang/LLVM β β Analysis β
β β β β β Tools β
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
- Quick Start Guide - Get started in 5 minutes
- Autonomous Debugging - Complete guide to hands-off debugging
- Architecture - System design and components
- Flowcharts - Visual system flows
- Virtual Environment Guide - Understanding local execution
- Contributing - How to contribute
- Project Summary - Detailed project overview
# Reproduce customer issue
copilot> generate test "Customer reports crash when input > 1000"
# Debug autonomously
copilot> autodebug ./app "Find why crash occurs with large input"
# Analyze and fix
copilot> suggest fix app.c# Generate optimized code
copilot> generate ir app.c --opt O3
# Analyze optimizations
copilot> analyze ir app.c
# Compare assembly
copilot> generate assembly app.c --opt O0
copilot> generate assembly app.c --opt O3# Find memory leaks
copilot> autodebug ./program "Identify memory leak"
# Analyze allocations
copilot> debug ./program
copilot> break malloc
copilot> break free# Analyze core dump
copilot> analyze crash ./program --core core.dump
# Get AI explanation
copilot> "Explain this crash"All interactions are saved:
# View session history
cat sessions/session_20260605_120000.md
# View autonomous debugging session
cat sessions/autodebug_debug_1717567890.jsonModel Context Protocol support for advanced tool integration:
# MCP server provides tools to AI
- execute_debugger_command
- analyze_compiler_output
- generate_test_case# Adjust autonomous debugging steps
auto_debugger = AutonomousDebugger(
max_steps=100, # Increase for complex issues
debugger_type='lldb'
)- OS: macOS, Linux (Windows WSL)
- Python: 3.8 or higher
- Debugger: GDB 8.0+ or LLDB 10.0+
- Compiler: Clang/LLVM 10.0+
prompt_toolkit- Interactive shellrich- Beautiful terminal outputrequests- API communicationpython-dotenv- Environment configuration
- IBM Cloud account
- watsonx.ai access
- API key and project ID
CompilerCopilot/
βββ src/
β βββ debugger/
β β βββ gdb_wrapper.py # GDB integration
β β βββ lldb_wrapper.py # LLDB integration
β β βββ autonomous_debugger.py # Autonomous debugging
β βββ compiler/
β β βββ analyzer.py # Compiler analysis
β β βββ tools.py # Binary analysis tools
β βββ llm/
β β βββ ibm_bob_client.py # IBM BOB integration
β βββ shell/
β β βββ interactive_v2.py # Interactive shell
β βββ mcp/
β βββ server.py # MCP server
βββ config/
β βββ env.example # Configuration template
βββ docs/
β βββ QUICKSTART.md
β βββ AUTONOMOUS_DEBUGGING.md
β βββ ARCHITECTURE.md
β βββ FLOWCHART.md
βββ examples/
β βββ sample_program.c
β βββ workflow_examples.md
βββ sessions/ # Session history storage
βββ setup.sh # Setup script
βββ configure.sh # Configuration wizard
βββ compiler-copilot.sh # Main launcher
βββ README.md
We welcome contributions! See CONTRIBUTING.md for guidelines.
# Clone repository
git clone https://github.com/yourusername/CompilerCopilot.git
cd CompilerCopilot
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run tests
python -m pytest tests/This project is licensed under the MIT License - see the LICENSE file for details.
- IBM watsonx - AI-powered analysis and decision making
- GDB/LLDB - Powerful debugging capabilities
- LLVM/Clang - Compiler infrastructure
- Open Source Community - Various tools and libraries
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Multi-threaded debugging support
- Performance profiling integration
- Automatic fix application
- Regression test generation
- VS Code extension
- Web interface
- Docker containerization
- CI/CD integration examples
If you find this project useful, please consider giving it a star!
Made with β€οΈ by the Compiler Copilot Team
Empowering developers with AI-assisted debugging and compiler analysis