
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
A comprehensive Python "core dump" system that captures execution state (variables, frames, stack traces) for post-mortem debugging, similar to C++ core dumps.
Requirements:
# Basic installation
pip install coredump-debugger
# With optional dependencies for better theme detection
pip install coredump-debugger[dev]
The debugger will work without term_background
but will have more accurate theme detection when it's available.
After installation, the dpdb
command will be available in your system PATH. The package automatically creates a console script entry point that installs the dpdb
executable.
Dpdb provides a command-line interface similar to pdb
for running programs with automatic crash handling:
# Run a Python program with automatic core dump generation
dpdb my_program.py arg1 arg2
# Debug an existing core dump file
dpdb crash_dump.pkl
# Get help
dpdb --help
Mode 1: Program Execution with Crash Handling
dpdb my_program.py arg1 arg2
This automatically installs the global core dump handler and runs your program. If the program crashes, a core dump file will be created automatically.
Mode 2: Core Dump Debugging
dpdb crash_dump.pkl
This loads an existing core dump file and starts the interactive debugger.
Just add dpdb.install_exception_handler("path/to/core_dump.pkl")
to your code, and a core dump will be created and saved automatically when an exception occurs.
import dpdb
# Install automatic core dump generation
dpdb.install_exception_handler("my_app_crash.pkl")
# Your application code here
def my_function():
x = 42
y = "hello"
# This will create a core dump if an exception occurs
result = 1 / 0 # ZeroDivisionError
my_function()
import dpdb
def debug_point():
local_var = "debug info"
data = [1, 2, 3, 4, 5]
# Create a manual core dump
dump = dpdb.CoreDumpGenerator.create_from_current_stack()
dpdb.save_core_dump(dump, "debug_dump.pkl")
debug_point()
Attach Dpdb to a core dump file:
# Debug a core dump file
dpdb my_app_crash.pkl
# Or using the module
python -m dpdb my_app_crash.pkl
The dpdb
command provides a powerful interface for both running programs with crash protection and debugging existing core dumps.
# Run a program with automatic crash handling
dpdb my_script.py arg1 arg2
# Debug an existing core dump
dpdb crash_dump.pkl
# Get help
dpdb --help
dpdb -h
Running a Program with Crash Protection:
# Run a script that might crash
dpdb my_data_processor.py input.csv output.json
# Run with multiple arguments
dpdb my_web_server.py --port 8080 --debug
# The program runs normally, but if it crashes, a core dump is created
Debugging a Core Dump:
# After a crash, debug the generated core dump
dpdb main_process_12345_crash.pkl
# This starts the interactive debugger with full source code access
Program Execution Mode: When you run dpdb my_program.py
, the system:
Core Dump Debugging Mode: When you run dpdb crash_dump.pkl
, the system:
sys.argv
argumentsThe interactive debugger provides the following commands with rich terminal formatting:
up [count]
or u [count]
- Move up the stack (towards caller)down [count]
or d [count]
- Move down the stack (towards callee)where
or w
or bt
- Show stack trace with current frame indicatorframe [num]
or f [num]
- Select frame by numberframes
- Show detailed frame informationlist
or l
- Show source code context for current framelonglist
or ll
- Show extended source code for current framelocals
- Show local variables in current frameglobals
- Show global variables in current frameargs
or a
- Show function argumentsinfo
- Show core dump information (timestamp, Python version, etc.)source [object]
- Show source code for objectp <expression>
- Print expression valuepp <expression>
- Pretty-print expression valuewhatis <expression>
- Show expression type<statement>
- Execute Python code directlydisplay <expression>
- Add expression to auto-display listundisplay [expression]
- Remove from auto-display listinteract
- Start interactive Python interpreterhelp
or h
- Show help informationquit
or q
- Exit the debuggerThe debugger automatically detects your terminal's theme (light or dark) and adjusts colors accordingly for optimal readability. The detection uses multiple methods:
You can override the automatic detection by setting an environment variable:
# Force light theme
export DPDB_THEME=light
# Force dark theme
export DPDB_THEME=dark
# Let the system auto-detect (default)
unset DPDB_THEME
dpdb <program.py> [args...]
- Run program with automatic crash handlingdpdb <dump_file>
- Debug an existing core dumpdpdb --help
- Show usage informationcreate_from_exception(exc_type, exc_value, exc_traceback)
- Create core dump from exceptioncreate_from_current_stack()
- Create core dump from current call stacksave_core_dump(core_dump, filename)
- Save core dump to fileload_core_dump(filename)
- Load core dump from fileinstall_exception_handler(dump_filename)
- Install automatic exception handlerinstall_global_handler()
- Install global handler for all processesuninstall_global_handler()
- Uninstall global handler and restore normal behavior__init__(core_dump)
- Initialize with a core dumprun()
- Start interactive debugging sessionThe core dump system provides excellent support for multiprocessing applications through a global handler that automatically applies core dump handling to ALL processes, including those created by frameworks you can't modify:
import dpdb
import multiprocessing as mp
# Install global handler once at the start of your program
dpdb.install_global_handler()
# Now ALL processes will automatically generate core dumps on crashes
# No code modification needed!
def worker_function(data):
# Your worker code here
result = process_data(data)
return result
# Standard multiprocessing - no changes needed
process = mp.Process(target=worker_function, args=(data,))
process.start()
process.join()
# Works with frameworks like accelerate, torch.distributed, etc.
# that control process creation
The global handler works seamlessly with existing frameworks:
import dpdb
# Install once at the start of your program
dpdb.install_global_handler()
# Now accelerate, torch.distributed, etc. will automatically
# generate core dumps for crashed processes
from accelerate import Accelerator
accelerator = Accelerator()
# All processes launched by accelerate will have core dump support
Core dumps may contain sensitive information (passwords, tokens, etc.), so
This code is provided under GPLv3.
FAQs
Python core dump system for post-mortem debugging
We found that coredump-debugger demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.