Skip to content

Commit 5d49b8e

Browse files
committed
Only display the extended stack trace if enableDisplayExtendedBacktrace is true and document enableDisplayExtendedBacktrace.
1 parent 41ede62 commit 5d49b8e

File tree

8 files changed

+45
-2
lines changed

8 files changed

+45
-2
lines changed

lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ def request_launch(
765765
runInTerminal=False,
766766
postRunCommands=None,
767767
enableAutoVariableSummaries=False,
768+
enableDisplayExtendedBacktrace=False,
768769
enableSyntheticChildDebugging=False,
769770
commandEscapePrefix=None,
770771
customFrameFormat=None,
@@ -817,6 +818,7 @@ def request_launch(
817818

818819
args_dict["enableAutoVariableSummaries"] = enableAutoVariableSummaries
819820
args_dict["enableSyntheticChildDebugging"] = enableSyntheticChildDebugging
821+
args_dict["enableDisplayExtendedBacktrace"] = enableDisplayExtendedBacktrace
820822
args_dict["commandEscapePrefix"] = commandEscapePrefix
821823
command_dict = {"command": "launch", "type": "request", "arguments": args_dict}
822824
response = self.send_recv(command_dict)

lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ def launch(
386386
expectFailure=False,
387387
postRunCommands=None,
388388
enableAutoVariableSummaries=False,
389+
enableDisplayExtendedBacktrace=False,
389390
enableSyntheticChildDebugging=False,
390391
commandEscapePrefix=None,
391392
customFrameFormat=None,
@@ -427,6 +428,7 @@ def cleanup():
427428
runInTerminal=runInTerminal,
428429
postRunCommands=postRunCommands,
429430
enableAutoVariableSummaries=enableAutoVariableSummaries,
431+
enableDisplayExtendedBacktrace=enableDisplayExtendedBacktrace,
430432
enableSyntheticChildDebugging=enableSyntheticChildDebugging,
431433
commandEscapePrefix=commandEscapePrefix,
432434
customFrameFormat=customFrameFormat,
@@ -466,6 +468,7 @@ def build_and_launch(
466468
postRunCommands=None,
467469
lldbDAPEnv=None,
468470
enableAutoVariableSummaries=False,
471+
enableDisplayExtendedBacktrace=False,
469472
enableSyntheticChildDebugging=False,
470473
commandEscapePrefix=None,
471474
customFrameFormat=None,
@@ -502,6 +505,7 @@ def build_and_launch(
502505
postRunCommands=postRunCommands,
503506
enableAutoVariableSummaries=enableAutoVariableSummaries,
504507
enableSyntheticChildDebugging=enableSyntheticChildDebugging,
508+
enableDisplayExtendedBacktrace=enableDisplayExtendedBacktrace,
505509
commandEscapePrefix=commandEscapePrefix,
506510
customFrameFormat=customFrameFormat,
507511
customThreadFormat=customThreadFormat,

lldb/test/API/tools/lldb-dap/extendedStackTrace/TestDAP_extendedStackTrace.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def test_stackTrace(self):
3636
"DYLD_LIBRARY_PATH=/usr/lib/system/introspection",
3737
"DYLD_INSERT_LIBRARIES=" + backtrace_recording_lib,
3838
],
39+
enableDisplayExtendedBacktrace=True,
3940
)
4041
source = "main.m"
4142
breakpoint = line_number(source, "breakpoint 1")

lldb/tools/lldb-dap/DAP.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ DAP::DAP()
3636
focus_tid(LLDB_INVALID_THREAD_ID), stop_at_entry(false), is_attach(false),
3737
enable_auto_variable_summaries(false),
3838
enable_synthetic_child_debugging(false),
39+
enable_display_extended_backtrace(false),
3940
restarting_process_id(LLDB_INVALID_PROCESS_ID),
4041
configuration_done_sent(false), waiting_for_run_in_terminal(false),
4142
progress_event_reporter(

lldb/tools/lldb-dap/DAP.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ struct DAP {
185185
bool is_attach;
186186
bool enable_auto_variable_summaries;
187187
bool enable_synthetic_child_debugging;
188+
bool enable_display_extended_backtrace;
188189
// The process event thread normally responds to process exited events by
189190
// shutting down the entire adapter. When we're restarting, we keep the id of
190191
// the old process here so we can detect this case and keep running.

lldb/tools/lldb-dap/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ file that defines how your program will be run. The JSON configuration file can
3636
|**terminateCommands** |[string]| | LLDB commands executed when the debugging session ends. Commands and command output will be sent to the debugger console when they are executed.
3737
|**sourceMap** |[string[2]]| | Specify an array of path re-mappings. Each element in the array must be a two element array containing a source and destination pathname.
3838
|**debuggerRoot** | string| |Specify a working directory to use when launching lldb-dap. If the debug information in your executable contains relative paths, this option can be used so that `lldb-dap` can find source files and object files that have relative paths.
39+
|**enableAutoVariableSummaries**|bool| | Enable auto generated summaries for variables when no summaries exist for a given type. This feature can cause performance delays in large projects when viewing variables.
40+
|**enableDisplayExtendedBacktrace**|bool| | Enable language specific extended backtraces.
41+
|**enableSyntheticChildDebugging**|bool| | If a variable is displayed using a synthetic children, also display the actual contents of the variable at the end under a [raw] entry. This is useful when creating sythetic child plug-ins as it lets you see the actual contents of the variable.
3942

4043
### Attaching Settings
4144

@@ -62,6 +65,9 @@ The JSON configuration file can contain the following `lldb-dap` specific launch
6265
|**exitCommands** |[string]| | LLDB commands executed when the program exits. Commands and command output will be sent to the debugger console when they are executed.
6366
|**terminateCommands** |[string]| | LLDB commands executed when the debugging session ends. Commands and command output will be sent to the debugger console when they are executed.
6467
|**attachCommands** |[string]| | LLDB commands that will be executed after **preRunCommands** which take place of the code that normally does the attach. The commands can create a new target and attach or launch it however desired. This allows custom launch and attach configurations. Core files can use `target create --core /path/to/core` to attach to core files.
68+
|**enableAutoVariableSummaries**|bool| | Enable auto generated summaries for variables when no summaries exist for a given type. This feature can cause performance delays in large projects when viewing variables.
69+
|**enableDisplayExtendedBacktrace**|bool| | Enable language specific extended backtraces.
70+
|**enableSyntheticChildDebugging**|bool| | If a variable is displayed using a synthetic children, also display the actual contents of the variable at the end under a [raw] entry. This is useful when creating sythetic child plug-ins as it lets you see the actual contents of the variable.
6571

6672
### Example configurations
6773

lldb/tools/lldb-dap/lldb-dap.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ void request_attach(const llvm::json::Object &request) {
704704
GetBoolean(arguments, "enableAutoVariableSummaries", false);
705705
g_dap.enable_synthetic_child_debugging =
706706
GetBoolean(arguments, "enableSyntheticChildDebugging", false);
707+
g_dap.enable_display_extended_backtrace =
708+
GetBoolean(arguments, "enableDisplayExtendedBacktrace", false);
707709
g_dap.command_escape_prefix =
708710
GetString(arguments, "commandEscapePrefix", "`");
709711
g_dap.SetFrameFormat(GetString(arguments, "customFrameFormat"));
@@ -2048,6 +2050,8 @@ void request_launch(const llvm::json::Object &request) {
20482050
GetBoolean(arguments, "enableAutoVariableSummaries", false);
20492051
g_dap.enable_synthetic_child_debugging =
20502052
GetBoolean(arguments, "enableSyntheticChildDebugging", false);
2053+
g_dap.enable_display_extended_backtrace =
2054+
GetBoolean(arguments, "enableDisplayExtendedBacktrace", false);
20512055
g_dap.command_escape_prefix =
20522056
GetString(arguments, "commandEscapePrefix", "`");
20532057
g_dap.SetFrameFormat(GetString(arguments, "customFrameFormat"));
@@ -3285,6 +3289,10 @@ void request_stackTrace(const llvm::json::Object &request) {
32853289
1 /* one extra frame for a label between threads*/;
32863290
threadCluster.pop_back();
32873291

3292+
if (!g_dap.enable_display_extended_backtrace) {
3293+
break;
3294+
}
3295+
32883296
// Check for any extended backtraces.
32893297
for (uint32_t i = 0; i < process.GetNumExtendedBacktraceTypes(); i++) {
32903298
lldb::SBThread backtrace = current.GetExtendedBacktraceThread(

lldb/tools/lldb-dap/package.json

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,12 @@
237237
},
238238
"exitCommands": {
239239
"type": "array",
240-
"description": "Commands executed at the end of debugging session.",
240+
"description": "Commands executed when the program exits.",
241+
"default": []
242+
},
243+
"terminateCommands": {
244+
"type": "array",
245+
"description": "Commands executed when the debugging session ends.",
241246
"default": []
242247
},
243248
"runInTerminal": {
@@ -254,6 +259,11 @@
254259
"description": "Enable auto generated summaries for variables when no summaries exist for a given type. This feature can cause performance delays in large projects when viewing variables.",
255260
"default": false
256261
},
262+
"enableDisplayExtendedBacktrace": {
263+
"type": "boolean",
264+
"description": "Enable language specific extended backtraces.",
265+
"default": false
266+
},
257267
"enableSyntheticChildDebugging": {
258268
"type": "boolean",
259269
"description": "If a variable is displayed using a synthetic children, also display the actual contents of the variable at the end under a [raw] entry. This is useful when creating sythetic child plug-ins as it lets you see the actual contents of the variable.",
@@ -342,7 +352,12 @@
342352
},
343353
"exitCommands": {
344354
"type": "array",
345-
"description": "Commands executed at the end of debugging session.",
355+
"description": "Commands executed when the program exits.",
356+
"default": []
357+
},
358+
"terminateCommands": {
359+
"type": "array",
360+
"description": "Commands executed when the debugging session ends.",
346361
"default": []
347362
},
348363
"coreFile": {
@@ -369,6 +384,11 @@
369384
"description": "Enable auto generated summaries for variables when no summaries exist for a given type. This feature can cause performance delays in large projects when viewing variables.",
370385
"default": false
371386
},
387+
"enableDisplayExtendedBacktrace": {
388+
"type": "boolean",
389+
"description": "Enable language specific extended backtraces.",
390+
"default": false
391+
},
372392
"enableSyntheticChildDebugging": {
373393
"type": "boolean",
374394
"description": "If a variable is displayed using a synthetic children, also display the actual contents of the variable at the end under a [raw] entry. This is useful when creating sythetic child plug-ins as it lets you see the actual contents of the variable.",

0 commit comments

Comments
 (0)