зеркало из https://github.com/mozilla/subhub.git
Debugging with GDB.
This commit is contained in:
Родитель
0f5c8b6569
Коммит
72b063c0cc
|
@ -0,0 +1,42 @@
|
|||
# Persistent history:
|
||||
set history save
|
||||
set history filename ~/.gdb_history
|
||||
|
||||
set auto-load python-scripts on
|
||||
show auto-load python-scripts on
|
||||
info auto-load python-scripts
|
||||
|
||||
# Pretty Print Output
|
||||
set print pretty
|
||||
|
||||
# Print the full stack trace when it crashes:
|
||||
set python print-stack full
|
||||
|
||||
# Colored prompt:
|
||||
set prompt \001\033[1;32m\002(gdb)\001\033[0m\002\040
|
||||
|
||||
# When displaying a pointer to an object, identify the actual (derived) type of the object rather than the declared type, using the virtual function table.
|
||||
set print object on
|
||||
|
||||
# Print using only seven-bit characters
|
||||
set print sevenbit-strings off
|
||||
|
||||
# Convert GDB to interpret in Python
|
||||
python
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
# Execute a Python using the user's shell and pull out the sys.path
|
||||
# from that version
|
||||
sys.path.insert(0, join(dirname(realpath(__file__)), 'src'))
|
||||
paths = eval(subprocess.check_output('python -c "import sys;print(sys.path)"',
|
||||
shell=True).strip())
|
||||
print(paths)
|
||||
# Extend the current GDB instance's Python paths
|
||||
sys.path.extend(paths)
|
||||
end
|
||||
|
||||
# References
|
||||
# 1. https://chezsoi.org/lucas/blog/gdb-python-macros.html
|
||||
# 2. https://interrupt.memfault.com/blog/using-pypi-packages-with-GDB
|
||||
# 3. https://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_57.html
|
|
@ -145,3 +145,6 @@ node_modules/
|
|||
|
||||
# ignore specific symlink
|
||||
services/fxa/sls
|
||||
|
||||
# GDB History
|
||||
.gdb_history
|
||||
|
|
|
@ -15,6 +15,8 @@ Payment subscription REST api for customers:
|
|||
|
||||
### [Build System](./docs/doit.md)
|
||||
|
||||
### [Debugging](./docs/debugging.md)
|
||||
|
||||
### [RESTful Service Interactions](./docs/rest.md)
|
||||
|
||||
### [Performance Testing](./src/sub/tests/performance/README.md)
|
||||
|
|
|
@ -6,7 +6,7 @@ sudo apt-get uninstall -y python
|
|||
# Install Python 3.7 and pip
|
||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y python3.7 python3.7-dev python3-pip python3.7-venv
|
||||
sudo apt-get install -y python3.7 python3.7-dev python3-pip python3.7-venv python3.7-dgb gdb
|
||||
|
||||
# Install Yarn
|
||||
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
# Debugging
|
||||
|
||||
## GDB
|
||||
|
||||
1. Set environment variables for the environment to be debugged.
|
||||
2. Spin up associated docker container for dynalite if required, `docker-compose up dynalite`. If you are debugging against AWS DynamoDB itself be sure to setup your AWS Credentials accordingly.
|
||||
3. Install packages: `sudo pip install -r src/app_requirements.txt`
|
||||
4. Set the PYTHONPATH for gdb: `export PYTHONPATH=/opt/subhub/src/:PYTHONPATH`
|
||||
5. Start gdb: `gdb python3.7`
|
||||
6. Run the application of choise: `run APPLICATION`
|
||||
|
||||
Where APPLICATION is either
|
||||
* `src/sub/app.py`
|
||||
* `src/hub/app.py`
|
Загрузка…
Ссылка в новой задаче