Setup
Once you did setup debugging with GDB, you can use its features through VSCode by installing "GDB Debugger - Beyond" and configuring launch.json.
From the VSCode Extensions Marketplace, install GDB Debugger - Beyond
Attach to Running Process
Use the pickProcess feature to attach to and existing process (you can filter by name/port to find the correct one).
Example:
Code Block | ||
---|---|---|
| ||
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(gdb) Attach to impalad", "type": "cppdbg", "request": "attach", "program": "${workspaceFolder}/be/build/latest/service/impalad", "processId": "${command:pickProcess}", "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true }, { "description": "Set Disassembly Flavor to Intel", "text": "-gdb-set disassembly-flavor intel", "ignoreFailures": true } ] } ] } |
Launch Impalad from VSCode
In the Run and Debug section, click the drop-down arrow and select "Add Config (be)". Note, if this option only exists if the Impala backend code is contained within a top-level workspace folder named "be". If the backend code is set up in a different location, choose the "Add Config" option for that location.
The "{{IMPALA_HOME}}" placeholder must be replaced with the actual value of the "$IMPALA_HOME" environment variable.
The "{{CLASSPATH}}" placeholder must be replaced with the full JVM classpath. Run the command source
$IMPALA_HOME/bin/set-classpath.sh && echo $CLASSPATH
to retrieve the whole classpath. Copy and paste the resulting value. VSCode will not properly syntax highlight, but everything is still ok.
Code Block | ||
---|---|---|
| ||
{
"version": "0.2.0",
"configurations": [
{
"name": "Impala BE",
"type": "by-gdb",
"request": "launch",
"program": "{{IMPALA_HOME}}/be/build/latest/service/impalad",
"cwd": "{{IMPALA_HOME}}",
"programArgs": "-disconnected_session_timeout 21600 -kudu_client_rpc_timeout_ms 0 -kudu_master_hosts localhost -mem_limit=12884901888 -logbufsecs=5 -v=1 -max_log_files=10 -log_filename=impalad -log_dir=/home/jfehr/dev/impala/logs/cluster -beeswax_port=21004 -hs2_port=21054 -hs2_http_port=28004 -krpc_port=27004 -state_store_subscriber_port=23004 -webserver_port=25004 -geospatial_library=HIVE_ESRI",
"commandsBeforeExec": [
"set environment CLASSPATH {{CLASSPATH}}"
]
}
]
} |