[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
eronnen wrote: @jasonmolenda fair enough, but still as a user who would like to see assembly instead of an error when the source is not available I don't have any solution currently. If I were to check the `stop-disassembly-display` value when returning the source info, would that be acceptable? https://github.com/llvm/llvm-project/pull/136494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
jasonmolenda wrote: Just to be super clear, if we were talking about core lldb behavior, I would be insistent about how it behaves. But we're talking about DAP and i'm just a bystander on that part of the codebase, and my feedback is just an opinion that you might want to consider, but don't feel like you need to address my point. https://github.com/llvm/llvm-project/pull/136494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use llvm::unique (NFC) (PR #136527)
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/136527 None >From a053656528fc7c1495b971fb77da030215aeb0e5 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 20 Apr 2025 18:31:31 -0700 Subject: [PATCH] [lldb] Use llvm::unique (NFC) --- lldb/source/Symbol/Symtab.cpp | 6 ++ lldb/source/Target/Target.cpp | 5 ++--- lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp | 3 +-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index 3c5075d9bb18b..9aee5d3e813d8 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -642,7 +642,7 @@ void Symtab::SortSymbolIndexesByValue(std::vector &indexes, // Remove any duplicates if requested if (remove_duplicates) { -auto last = std::unique(indexes.begin(), indexes.end()); +auto last = llvm::unique(indexes); indexes.erase(last, indexes.end()); } } @@ -1151,9 +1151,7 @@ void Symtab::FindFunctionSymbols(ConstString name, uint32_t name_type_mask, if (!symbol_indexes.empty()) { llvm::sort(symbol_indexes); -symbol_indexes.erase( -std::unique(symbol_indexes.begin(), symbol_indexes.end()), -symbol_indexes.end()); +symbol_indexes.erase(llvm::unique(symbol_indexes), symbol_indexes.end()); SymbolIndicesToSymbolContextList(symbol_indexes, sc_list); } } diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index b6186b76d6236..0fa61b20e19b9 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -2641,9 +2641,8 @@ Target::GetScratchTypeSystems(bool create_on_demand) { } std::sort(scratch_type_systems.begin(), scratch_type_systems.end()); - scratch_type_systems.erase( - std::unique(scratch_type_systems.begin(), scratch_type_systems.end()), - scratch_type_systems.end()); + scratch_type_systems.erase(llvm::unique(scratch_type_systems), + scratch_type_systems.end()); return scratch_type_systems; } diff --git a/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp b/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp index 022baf77458d0..7a477f3e97875 100644 --- a/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp @@ -189,8 +189,7 @@ void BreakpointLocationsRequestHandler::operator()( // The line entries are sorted by addresses, but we must return the list // ordered by line / column position. std::sort(locations.begin(), locations.end()); - locations.erase(std::unique(locations.begin(), locations.end()), - locations.end()); + locations.erase(llvm::unique(locations), locations.end()); llvm::json::Array locations_json; for (auto &l : locations) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 2ba20c5 - [lldb] Use llvm::unique (NFC) (#136527)
Author: Kazu Hirata Date: 2025-04-20T19:59:37-07:00 New Revision: 2ba20c52e43ae881dc54037fff94d7e2f217c99d URL: https://github.com/llvm/llvm-project/commit/2ba20c52e43ae881dc54037fff94d7e2f217c99d DIFF: https://github.com/llvm/llvm-project/commit/2ba20c52e43ae881dc54037fff94d7e2f217c99d.diff LOG: [lldb] Use llvm::unique (NFC) (#136527) Added: Modified: lldb/source/Symbol/Symtab.cpp lldb/source/Target/Target.cpp lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp Removed: diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index 3c5075d9bb18b..9aee5d3e813d8 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -642,7 +642,7 @@ void Symtab::SortSymbolIndexesByValue(std::vector &indexes, // Remove any duplicates if requested if (remove_duplicates) { -auto last = std::unique(indexes.begin(), indexes.end()); +auto last = llvm::unique(indexes); indexes.erase(last, indexes.end()); } } @@ -1151,9 +1151,7 @@ void Symtab::FindFunctionSymbols(ConstString name, uint32_t name_type_mask, if (!symbol_indexes.empty()) { llvm::sort(symbol_indexes); -symbol_indexes.erase( -std::unique(symbol_indexes.begin(), symbol_indexes.end()), -symbol_indexes.end()); +symbol_indexes.erase(llvm::unique(symbol_indexes), symbol_indexes.end()); SymbolIndicesToSymbolContextList(symbol_indexes, sc_list); } } diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index b6186b76d6236..0fa61b20e19b9 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -2641,9 +2641,8 @@ Target::GetScratchTypeSystems(bool create_on_demand) { } std::sort(scratch_type_systems.begin(), scratch_type_systems.end()); - scratch_type_systems.erase( - std::unique(scratch_type_systems.begin(), scratch_type_systems.end()), - scratch_type_systems.end()); + scratch_type_systems.erase(llvm::unique(scratch_type_systems), + scratch_type_systems.end()); return scratch_type_systems; } diff --git a/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp b/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp index 022baf77458d0..7a477f3e97875 100644 --- a/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp @@ -189,8 +189,7 @@ void BreakpointLocationsRequestHandler::operator()( // The line entries are sorted by addresses, but we must return the list // ordered by line / column position. std::sort(locations.begin(), locations.end()); - locations.erase(std::unique(locations.begin(), locations.end()), - locations.end()); + locations.erase(llvm::unique(locations), locations.end()); llvm::json::Array locations_json; for (auto &l : locations) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use llvm::unique (NFC) (PR #136527)
https://github.com/kazutakahirata closed https://github.com/llvm/llvm-project/pull/136527 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use llvm::unique (NFC) (PR #136527)
https://github.com/kuhar approved this pull request. https://github.com/llvm/llvm-project/pull/136527 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
jasonmolenda wrote: One side note, I was commenting while not 100% awake and didn't realize this was only in the DAP side of the codebase, I have less weight to argue one way or the other there. After I posted that I was like, I wonder why I didn't see the `stop-assembly-display` preference used around that diff. :) My comment is much weaker when it's only impacting the DAP replies, fwiw. I think from a UI perspective defaulting to not showing assembly when we have filename & line number is the best tradeoff for users, but like most UI things it's debatable. I think using `stop-assembly-display` here would be a good thing for sure. If people think that the DAP front end should default to showing assembly in this case, I don't have a strong opinion on that, I haven't lived on those IDEs myself and I don't feel qualified to say anything. https://github.com/llvm/llvm-project/pull/136494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
eronnen wrote: Maybe this setting should be exposed in the vscode launch configuration so it will be more findable for users though https://github.com/llvm/llvm-project/pull/136494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use llvm::unique (NFC) (PR #136527)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Kazu Hirata (kazutakahirata) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/136527.diff 3 Files Affected: - (modified) lldb/source/Symbol/Symtab.cpp (+2-4) - (modified) lldb/source/Target/Target.cpp (+2-3) - (modified) lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp (+1-2) ``diff diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index 3c5075d9bb18b..9aee5d3e813d8 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -642,7 +642,7 @@ void Symtab::SortSymbolIndexesByValue(std::vector &indexes, // Remove any duplicates if requested if (remove_duplicates) { -auto last = std::unique(indexes.begin(), indexes.end()); +auto last = llvm::unique(indexes); indexes.erase(last, indexes.end()); } } @@ -1151,9 +1151,7 @@ void Symtab::FindFunctionSymbols(ConstString name, uint32_t name_type_mask, if (!symbol_indexes.empty()) { llvm::sort(symbol_indexes); -symbol_indexes.erase( -std::unique(symbol_indexes.begin(), symbol_indexes.end()), -symbol_indexes.end()); +symbol_indexes.erase(llvm::unique(symbol_indexes), symbol_indexes.end()); SymbolIndicesToSymbolContextList(symbol_indexes, sc_list); } } diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index b6186b76d6236..0fa61b20e19b9 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -2641,9 +2641,8 @@ Target::GetScratchTypeSystems(bool create_on_demand) { } std::sort(scratch_type_systems.begin(), scratch_type_systems.end()); - scratch_type_systems.erase( - std::unique(scratch_type_systems.begin(), scratch_type_systems.end()), - scratch_type_systems.end()); + scratch_type_systems.erase(llvm::unique(scratch_type_systems), + scratch_type_systems.end()); return scratch_type_systems; } diff --git a/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp b/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp index 022baf77458d0..7a477f3e97875 100644 --- a/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp @@ -189,8 +189,7 @@ void BreakpointLocationsRequestHandler::operator()( // The line entries are sorted by addresses, but we must return the list // ordered by line / column position. std::sort(locations.begin(), locations.end()); - locations.erase(std::unique(locations.begin(), locations.end()), - locations.end()); + locations.erase(llvm::unique(locations), locations.end()); llvm::json::Array locations_json; for (auto &l : locations) { `` https://github.com/llvm/llvm-project/pull/136527 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
https://github.com/JDevlieghere commented: The change LGTM but please add a test. You should be able to remove the source file between building and launching LLDB. I believe there are some examples of that in the LLDB test suite. https://github.com/llvm/llvm-project/pull/136494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
jasonmolenda wrote: Maybe I'm missing something, but I disagree with this change. We're talking about when you're stopped in a stack frame that has debug info (a file and line number), but the source file is unavailable, right. There is a setting to control this behavior already -- `stop-disassembly-display`. It defaults to `no-debuginfo`, but it can be `never`, `always`, `no-source`, or `no-debuginfo`. People who are debugging at a source level, generally, do not want to see assembly, and in fact will be confused if they are shown assembly. We do not want to show assembly for a stack frame where we have a debug filename and line number, by default. The user may not have set up the target.source-map to map lldb to the source file, and could be looking at it in another source window as they're stepping, or they may know roughly how many lines a method has as they step through it. The assembly only adds distraction to them. Am I misunderstanding what we're talking about here? https://github.com/llvm/llvm-project/pull/136494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
https://github.com/eronnen updated https://github.com/llvm/llvm-project/pull/136494 >From 0bf4cfcbd1fe2a006a68cb6f85af9a09a49b47e7 Mon Sep 17 00:00:00 2001 From: Ely Ronnen Date: Sun, 20 Apr 2025 17:07:09 +0200 Subject: [PATCH 1/3] fallback to assembly when source code is not available --- lldb/tools/lldb-dap/JSONUtils.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 33f10c93d2ada..1a44df7740639 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -750,9 +750,10 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, EmplaceSafeString(object, "name", frame_name); auto line_entry = frame.GetLineEntry(); + auto file_spec = line_entry.GetFileSpec(); // A line entry of 0 indicates the line is compiler generated i.e. no source // file is associated with the frame. - if (line_entry.GetFileSpec().IsValid() && + if (file_spec.IsValid() && file_spec.Exists() && (line_entry.GetLine() != 0 || line_entry.GetLine() != LLDB_INVALID_LINE_NUMBER)) { object.try_emplace("source", CreateSource(line_entry)); >From cbcebed97b9ce9251aa27ee384347b283d0625d3 Mon Sep 17 00:00:00 2001 From: Ely Ronnen Date: Sun, 20 Apr 2025 21:03:02 +0200 Subject: [PATCH 2/3] fix TestDAP_coreFile.py with source maps --- .../API/tools/lldb-dap/coreFile/TestDAP_coreFile.py| 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py index 1896acea15a99..ce54133a61f3e 100644 --- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py +++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py @@ -19,7 +19,9 @@ def test_core_file(self): core_file = os.path.join(current_dir, "linux-x86_64.core") self.create_debug_adapter() -self.attach(exe_file, coreFile=core_file) + +source_map = [["/home/labath/test", current_dir]] +self.attach(exe_file, coreFile=core_file, sourceMap=source_map) expected_frames = [ { @@ -27,7 +29,7 @@ def test_core_file(self): "id": 524288, "line": 4, "name": "bar", -"source": {"name": "main.c", "path": "/home/labath/test/main.c"}, +"source": {"name": "main.c", "path": os.path.join(current_dir, "main.c")}, "instructionPointerReference": "0x40011C", }, { @@ -35,7 +37,7 @@ def test_core_file(self): "id": 524289, "line": 10, "name": "foo", -"source": {"name": "main.c", "path": "/home/labath/test/main.c"}, +"source": {"name": "main.c", "path": os.path.join(current_dir, "main.c")}, "instructionPointerReference": "0x400142", }, { @@ -43,7 +45,7 @@ def test_core_file(self): "id": 524290, "line": 16, "name": "_start", -"source": {"name": "main.c", "path": "/home/labath/test/main.c"}, +"source": {"name": "main.c", "path": os.path.join(current_dir, "main.c")}, "instructionPointerReference": "0x40015F", }, ] >From d2062b80083929a28a1e8e75d43ea5f96f057fa4 Mon Sep 17 00:00:00 2001 From: Ely Ronnen Date: Sun, 20 Apr 2025 21:04:46 +0200 Subject: [PATCH 3/3] use stop-disassembly-display setting to determine when to show disassembly --- .../lldb-dap/coreFile/TestDAP_coreFile.py | 10 +- .../stackTraceDisassemblyDisplay/Makefile | 3 + .../TestDAP_stackTraceDisassemblyDisplay.py | 120 ++ .../stackTraceDisassemblyDisplay/main.c | 10 ++ lldb/tools/lldb-dap/DAP.h | 4 + .../lldb-dap/Handler/AttachRequestHandler.cpp | 1 + .../lldb-dap/Handler/LaunchRequestHandler.cpp | 1 + .../tools/lldb-dap/Handler/RequestHandler.cpp | 4 + lldb/tools/lldb-dap/Handler/RequestHandler.h | 3 + .../Handler/StackTraceRequestHandler.cpp | 3 +- lldb/tools/lldb-dap/JSONUtils.cpp | 34 +++-- lldb/tools/lldb-dap/JSONUtils.h | 21 ++- lldb/tools/lldb-dap/LLDBUtils.cpp | 19 +++ lldb/tools/lldb-dap/LLDBUtils.h | 9 ++ 14 files changed, 225 insertions(+), 17 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/Makefile create mode 100644 lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/TestDAP_stackTraceDisassemblyDisplay.py create mode 100644 lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/main.c diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py index ce54133a61f3e..1896acea15a99 100644 --- a/lldb/test/API/tools/lldb-dap/coreFile/T
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r HEAD~1...HEAD lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/TestDAP_stackTraceDisassemblyDisplay.py `` View the diff from darker here. ``diff --- TestDAP_stackTraceDisassemblyDisplay.py 2025-04-20 20:59:48.00 + +++ TestDAP_stackTraceDisassemblyDisplay.py 2025-04-20 21:01:59.997663 + @@ -23,10 +23,11 @@ return b; // Break here } """ + @contextmanager def delete_file_on_exit(path): try: yield path finally: @@ -45,76 +46,150 @@ f.write(OTHER_C_SOURCE_CODE) breakpoint_line = line_number(other_source_file, "// Break here") program = self.getBuildArtifact("a.out") -init_commands = [f"settings set stop-disassembly-display {stop_disassembly_display}"] +init_commands = [ +f"settings set stop-disassembly-display {stop_disassembly_display}" +] self.build_and_launch(program, initCommands=init_commands) -breakpoint_ids = self.set_source_breakpoints(other_source_file, [breakpoint_line]) +breakpoint_ids = self.set_source_breakpoints( +other_source_file, [breakpoint_line] +) self.assertEqual( len(breakpoint_ids), 1, "expect correct number of breakpoints" ) self.continue_to_breakpoints(breakpoint_ids) - + frames = self.get_stackFrames() -self.assertLessEqual( -2, len(frames), "expect at least 2 frames" +self.assertLessEqual(2, len(frames), "expect at least 2 frames") + +self.assertIn( +"path", +frames[0]["source"], +"Expect source path to always be in frame (other.c)", ) - -self.assertIn("path", frames[0]["source"], "Expect source path to always be in frame (other.c)") -self.assertIn("path", frames[1]["source"], "Expect source path in always be in frame (main.c)") +self.assertIn( +"path", +frames[1]["source"], +"Expect source path in always be in frame (main.c)", +) return frames @skipIfWindows def test_stopDisassemblyDispay_noSource(self): """ Test that with with stop-disassembly-display = no-source - frames without source available give assembly code. """ frames = self.build_and_run_until_breakpoint("no-source") -self.assertNotIn("other.c", frames[0]["source"]["path"], "Expect original source path to not be in unavailable source frame (other.c)") -self.assertIn("sourceReference", frames[0]["source"], "Expect sourceReference source path in to be in unavailable source frame (other.c)") - -self.assertIn("main.c", frames[1]["source"]["path"], "Expect original source path to be in source code frame (main.c)") -self.assertNotIn("sourceReference", frames[1]["source"], "Expect no sourceReference in source code frame (main.c)") +self.assertNotIn( +"other.c", +frames[0]["source"]["path"], +"Expect original source path to not be in unavailable source frame (other.c)", +) +self.assertIn( +"sourceReference", +frames[0]["source"], +"Expect sourceReference source path in to be in unavailable source frame (other.c)", +) + +self.assertIn( +"main.c", +frames[1]["source"]["path"], +"Expect original source path to be in source code frame (main.c)", +) +self.assertNotIn( +"sourceReference", +frames[1]["source"], +"Expect no sourceReference in source code frame (main.c)", +) @skipIfWindows def test_stopDisassemblyDispay_noDebuginfo(self): """ Test that with with stop-disassembly-display = no-debuginfo - all frames give source code even when source not available. """ frames = self.build_and_run_until_breakpoint("no-debuginfo") -self.assertIn("other.c", frames[0]["source"]["path"], "Expect original source path to be in unavailable source frame (other.c)") -self.assertNotIn("sourceReference", frames[0]["source"], "Expect sourceReference source path in to be in unavailable source frame (other.c)") - -self.assertIn("main.c", frames[1]["source"]["path"], "Expect original source path to be in source code frame (main.c)") -self.assertNotIn("sourceReference", frames[1]["source"], "Expect no sourceReference in source code frame (main.c)") +self.assertIn( +"other.c", +frames[0]["source"]["path"], +"Expect original source path to
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
eronnen wrote: I refactored the code now to use the `stop-assembly-display` setting, I think it makes sense to use it especially since it support the `no-source` value which was what I was looking for https://github.com/llvm/llvm-project/pull/136494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
https://github.com/eronnen updated https://github.com/llvm/llvm-project/pull/136494 >From 0bf4cfcbd1fe2a006a68cb6f85af9a09a49b47e7 Mon Sep 17 00:00:00 2001 From: Ely Ronnen Date: Sun, 20 Apr 2025 17:07:09 +0200 Subject: [PATCH 1/3] fallback to assembly when source code is not available --- lldb/tools/lldb-dap/JSONUtils.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 33f10c93d2ada..1a44df7740639 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -750,9 +750,10 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, EmplaceSafeString(object, "name", frame_name); auto line_entry = frame.GetLineEntry(); + auto file_spec = line_entry.GetFileSpec(); // A line entry of 0 indicates the line is compiler generated i.e. no source // file is associated with the frame. - if (line_entry.GetFileSpec().IsValid() && + if (file_spec.IsValid() && file_spec.Exists() && (line_entry.GetLine() != 0 || line_entry.GetLine() != LLDB_INVALID_LINE_NUMBER)) { object.try_emplace("source", CreateSource(line_entry)); >From cbcebed97b9ce9251aa27ee384347b283d0625d3 Mon Sep 17 00:00:00 2001 From: Ely Ronnen Date: Sun, 20 Apr 2025 21:03:02 +0200 Subject: [PATCH 2/3] fix TestDAP_coreFile.py with source maps --- .../API/tools/lldb-dap/coreFile/TestDAP_coreFile.py| 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py index 1896acea15a99..ce54133a61f3e 100644 --- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py +++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py @@ -19,7 +19,9 @@ def test_core_file(self): core_file = os.path.join(current_dir, "linux-x86_64.core") self.create_debug_adapter() -self.attach(exe_file, coreFile=core_file) + +source_map = [["/home/labath/test", current_dir]] +self.attach(exe_file, coreFile=core_file, sourceMap=source_map) expected_frames = [ { @@ -27,7 +29,7 @@ def test_core_file(self): "id": 524288, "line": 4, "name": "bar", -"source": {"name": "main.c", "path": "/home/labath/test/main.c"}, +"source": {"name": "main.c", "path": os.path.join(current_dir, "main.c")}, "instructionPointerReference": "0x40011C", }, { @@ -35,7 +37,7 @@ def test_core_file(self): "id": 524289, "line": 10, "name": "foo", -"source": {"name": "main.c", "path": "/home/labath/test/main.c"}, +"source": {"name": "main.c", "path": os.path.join(current_dir, "main.c")}, "instructionPointerReference": "0x400142", }, { @@ -43,7 +45,7 @@ def test_core_file(self): "id": 524290, "line": 16, "name": "_start", -"source": {"name": "main.c", "path": "/home/labath/test/main.c"}, +"source": {"name": "main.c", "path": os.path.join(current_dir, "main.c")}, "instructionPointerReference": "0x40015F", }, ] >From dd8735e1eb7c9582a7f16d45f8106cbfcda2d02f Mon Sep 17 00:00:00 2001 From: Ely Ronnen Date: Sun, 20 Apr 2025 21:04:46 +0200 Subject: [PATCH 3/3] use stop-disassembly-display setting to determine when to show disassembly --- .../lldb-dap/coreFile/TestDAP_coreFile.py | 10 +- .../stackTraceDisassemblyDisplay/Makefile | 3 + .../TestDAP_stackTraceDisassemblyDisplay.py | 195 ++ .../stackTraceDisassemblyDisplay/main.c | 10 + lldb/tools/lldb-dap/DAP.h | 4 + .../lldb-dap/Handler/AttachRequestHandler.cpp | 1 + .../lldb-dap/Handler/LaunchRequestHandler.cpp | 1 + .../tools/lldb-dap/Handler/RequestHandler.cpp | 4 + lldb/tools/lldb-dap/Handler/RequestHandler.h | 3 + .../Handler/StackTraceRequestHandler.cpp | 3 +- lldb/tools/lldb-dap/JSONUtils.cpp | 34 ++- lldb/tools/lldb-dap/JSONUtils.h | 21 +- lldb/tools/lldb-dap/LLDBUtils.cpp | 19 ++ lldb/tools/lldb-dap/LLDBUtils.h | 9 + 14 files changed, 300 insertions(+), 17 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/Makefile create mode 100644 lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/TestDAP_stackTraceDisassemblyDisplay.py create mode 100644 lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/main.c diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py index ce54133a61f3e..1896acea15a99 100644 --- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
https://github.com/eronnen edited https://github.com/llvm/llvm-project/pull/136494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
https://github.com/eronnen edited https://github.com/llvm/llvm-project/pull/136494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] fix wrong assembly line number (PR #136486)
https://github.com/eronnen edited https://github.com/llvm/llvm-project/pull/136486 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use correct path for debugserver (PR #131609)
https://github.com/yuvald-sweet-security edited https://github.com/llvm/llvm-project/pull/131609 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use correct path for debugserver (PR #131609)
yuvald-sweet-security wrote: > I can push the button for you if you could just update the patch description > to what you'd like the commit message to say (in particular, I think the last > paragraph is no longer correct). > > As for cherry-picking, is this related to the lldb-server platform refactor > in any way, or is it a separate problem that has always been there (I'm > trying to figure out if this is a regression, at least for some cases) Alright, I edited it. This is not related to the lldb-server platform refactor, I get this issue even in Ubuntu's packaged lldb-server-19. https://github.com/llvm/llvm-project/pull/131609 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] fix wrong assembly line number (PR #136486)
https://github.com/eronnen created https://github.com/llvm/llvm-project/pull/136486 Fix wrong assembly line number calculation that assumes the instruction size is `GetAddressByteSize() / 2` >From 0efcbcfa2383e8ffac29904af90313f04bcdfa4a Mon Sep 17 00:00:00 2001 From: Ely Ronnen Date: Sun, 20 Apr 2025 14:27:53 +0200 Subject: [PATCH] fix wrong assembly line number when debugging assembly with different sized instructions --- .../Handler/StackTraceRequestHandler.cpp | 3 ++- lldb/tools/lldb-dap/JSONUtils.cpp | 22 ++- lldb/tools/lldb-dap/JSONUtils.h | 7 -- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/lldb/tools/lldb-dap/Handler/StackTraceRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/StackTraceRequestHandler.cpp index a58e3325af100..5d1d2835b4392 100644 --- a/lldb/tools/lldb-dap/Handler/StackTraceRequestHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/StackTraceRequestHandler.cpp @@ -67,7 +67,8 @@ static bool FillStackFrames(DAP &dap, lldb::SBThread &thread, break; } -stack_frames.emplace_back(CreateStackFrame(frame, dap.frame_format)); +stack_frames.emplace_back( +CreateStackFrame(frame, dap.frame_format, dap.target)); } if (dap.configuration.displayExtendedBacktrace && reached_end_of_stack) { diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 33f10c93d2ada..552fdc9439845 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -19,6 +19,8 @@ #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBFrame.h" #include "lldb/API/SBFunction.h" +#include "lldb/API/SBInstruction.h" +#include "lldb/API/SBInstructionList.h" #include "lldb/API/SBLineEntry.h" #include "lldb/API/SBModule.h" #include "lldb/API/SBQueue.h" @@ -719,8 +721,8 @@ llvm::json::Value CreateSource(llvm::StringRef source_path) { // }, // "required": [ "id", "name", "line", "column" ] // } -llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, - lldb::SBFormat &format) { +llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, lldb::SBFormat &format, + lldb::SBTarget &target) { llvm::json::Object object; int64_t frame_id = MakeDAPFrameID(frame); object.try_emplace("id", frame_id); @@ -776,10 +778,18 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, // Calculate the line of the current PC from the start of the current // symbol. -lldb::addr_t inst_offset = frame.GetPCAddress().GetOffset() - - frame.GetSymbol().GetStartAddress().GetOffset(); -lldb::addr_t inst_line = -inst_offset / (frame.GetThread().GetProcess().GetAddressByteSize() / 2); +lldb::SBAddress current_address = frame.GetPCAddress(); +lldb::SBInstructionList inst_list = +frame.GetSymbol().GetInstructions(target); +size_t inst_line = 0; +for (size_t i = 0; i < inst_list.GetSize(); ++i) { + lldb::SBInstruction inst = inst_list.GetInstructionAtIndex(i); + if (inst.GetAddress() == current_address) { +inst_line = i; +break; + } +} + // Line numbers are 1-based. object.try_emplace("line", inst_line + 1); object.try_emplace("column", 1); diff --git a/lldb/tools/lldb-dap/JSONUtils.h b/lldb/tools/lldb-dap/JSONUtils.h index b8c53353bf42d..ffa10743501b8 100644 --- a/lldb/tools/lldb-dap/JSONUtils.h +++ b/lldb/tools/lldb-dap/JSONUtils.h @@ -363,11 +363,14 @@ llvm::json::Value CreateSource(llvm::StringRef source_path); /// The LLDB format to use when populating out the "StackFrame" /// object. /// +/// \param[in] target +/// The LLDB target to use when populating out the "StackFrame" +/// object. /// \return /// A "StackFrame" JSON object with that follows the formal JSON /// definition outlined by Microsoft. -llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, - lldb::SBFormat &format); +llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, lldb::SBFormat &format, + lldb::SBTarget &target); /// Create a "StackFrame" label object for a LLDB thread. /// ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] fix wrong assembly line number (PR #136486)
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using `@` followed by their GitHub username. If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the [LLVM GitHub User Guide](https://llvm.org/docs/GitHub.html). You can also ask questions in a comment on this PR, on the [LLVM Discord](https://discord.com/invite/xS7Z362) or on the [forums](https://discourse.llvm.org/). https://github.com/llvm/llvm-project/pull/136486 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] fix wrong assembly line number (PR #136486)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Ely Ronnen (eronnen) Changes Fix wrong assembly line number calculation that assumes the instruction size is `GetAddressByteSize() / 2` --- Full diff: https://github.com/llvm/llvm-project/pull/136486.diff 3 Files Affected: - (modified) lldb/tools/lldb-dap/Handler/StackTraceRequestHandler.cpp (+2-1) - (modified) lldb/tools/lldb-dap/JSONUtils.cpp (+16-6) - (modified) lldb/tools/lldb-dap/JSONUtils.h (+5-2) ``diff diff --git a/lldb/tools/lldb-dap/Handler/StackTraceRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/StackTraceRequestHandler.cpp index a58e3325af100..5d1d2835b4392 100644 --- a/lldb/tools/lldb-dap/Handler/StackTraceRequestHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/StackTraceRequestHandler.cpp @@ -67,7 +67,8 @@ static bool FillStackFrames(DAP &dap, lldb::SBThread &thread, break; } -stack_frames.emplace_back(CreateStackFrame(frame, dap.frame_format)); +stack_frames.emplace_back( +CreateStackFrame(frame, dap.frame_format, dap.target)); } if (dap.configuration.displayExtendedBacktrace && reached_end_of_stack) { diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 33f10c93d2ada..552fdc9439845 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -19,6 +19,8 @@ #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBFrame.h" #include "lldb/API/SBFunction.h" +#include "lldb/API/SBInstruction.h" +#include "lldb/API/SBInstructionList.h" #include "lldb/API/SBLineEntry.h" #include "lldb/API/SBModule.h" #include "lldb/API/SBQueue.h" @@ -719,8 +721,8 @@ llvm::json::Value CreateSource(llvm::StringRef source_path) { // }, // "required": [ "id", "name", "line", "column" ] // } -llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, - lldb::SBFormat &format) { +llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, lldb::SBFormat &format, + lldb::SBTarget &target) { llvm::json::Object object; int64_t frame_id = MakeDAPFrameID(frame); object.try_emplace("id", frame_id); @@ -776,10 +778,18 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, // Calculate the line of the current PC from the start of the current // symbol. -lldb::addr_t inst_offset = frame.GetPCAddress().GetOffset() - - frame.GetSymbol().GetStartAddress().GetOffset(); -lldb::addr_t inst_line = -inst_offset / (frame.GetThread().GetProcess().GetAddressByteSize() / 2); +lldb::SBAddress current_address = frame.GetPCAddress(); +lldb::SBInstructionList inst_list = +frame.GetSymbol().GetInstructions(target); +size_t inst_line = 0; +for (size_t i = 0; i < inst_list.GetSize(); ++i) { + lldb::SBInstruction inst = inst_list.GetInstructionAtIndex(i); + if (inst.GetAddress() == current_address) { +inst_line = i; +break; + } +} + // Line numbers are 1-based. object.try_emplace("line", inst_line + 1); object.try_emplace("column", 1); diff --git a/lldb/tools/lldb-dap/JSONUtils.h b/lldb/tools/lldb-dap/JSONUtils.h index b8c53353bf42d..ffa10743501b8 100644 --- a/lldb/tools/lldb-dap/JSONUtils.h +++ b/lldb/tools/lldb-dap/JSONUtils.h @@ -363,11 +363,14 @@ llvm::json::Value CreateSource(llvm::StringRef source_path); /// The LLDB format to use when populating out the "StackFrame" /// object. /// +/// \param[in] target +/// The LLDB target to use when populating out the "StackFrame" +/// object. /// \return /// A "StackFrame" JSON object with that follows the formal JSON /// definition outlined by Microsoft. -llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, - lldb::SBFormat &format); +llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, lldb::SBFormat &format, + lldb::SBTarget &target); /// Create a "StackFrame" label object for a LLDB thread. /// `` https://github.com/llvm/llvm-project/pull/136486 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 839f521 - [lldb-dap] fix inconsistent debugAdapterHostname argument name (#135544)
Author: Ely Ronnen Date: 2025-04-20T08:33:28-07:00 New Revision: 839f52147c0cdbe7d4590cfdda089f250e5ec119 URL: https://github.com/llvm/llvm-project/commit/839f52147c0cdbe7d4590cfdda089f250e5ec119 DIFF: https://github.com/llvm/llvm-project/commit/839f52147c0cdbe7d4590cfdda089f250e5ec119.diff LOG: [lldb-dap] fix inconsistent debugAdapterHostname argument name (#135544) the argument is written as `debugAdapterHostname` in package.json but used as `debugAdapterHost` Added: Modified: lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts Removed: diff --git a/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts b/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts index e23d717a70101..3a86d1f3f418f 100644 --- a/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts +++ b/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts @@ -211,7 +211,7 @@ export class LLDBDapDescriptorFactory if (session.configuration.debugAdapterPort) { return new vscode.DebugAdapterServer( session.configuration.debugAdapterPort, -session.configuration.debugAdapterHost, +session.configuration.debugAdapterHostname, ); } diff --git a/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts b/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts index 0272509ee55f7..8d92139c02a00 100644 --- a/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts +++ b/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts @@ -32,11 +32,11 @@ export class LLDBDapConfigurationProvider ): Promise { try { if ( -"debugAdapterHost" in debugConfiguration && +"debugAdapterHostname" in debugConfiguration && !("debugAdapterPort" in debugConfiguration) ) { throw new ErrorWithNotification( - "A debugAdapterPort must be provided when debugAdapterHost is set. Please update your launch configuration.", + "A debugAdapterPort must be provided when debugAdapterHostname is set. Please update your launch configuration.", new ConfigureButton(), ); } @@ -83,7 +83,7 @@ export class LLDBDapConfigurationProvider // and list of arguments. delete debugConfiguration.debugAdapterExecutable; delete debugConfiguration.debugAdapterArgs; - debugConfiguration.debugAdapterHost = serverInfo.host; + debugConfiguration.debugAdapterHostname = serverInfo.host; debugConfiguration.debugAdapterPort = serverInfo.port; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] fix inconsistent debugAdapterHostname argument name (PR #135544)
github-actions[bot] wrote: @eronnen Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail [here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr). If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of [LLVM development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy). You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! https://github.com/llvm/llvm-project/pull/135544 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] fix inconsistent debugAdapterHostname argument name (PR #135544)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/135544 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
https://github.com/eronnen created https://github.com/llvm/llvm-project/pull/136494 Show assembly code when the source code for a frame is not available in the debugger machine Fix #136492 After the fix: [Screencast From 2025-04-20 18-00-30.webm](https://github.com/user-attachments/assets/1ce41715-cf4f-42a1-8f5c-6196b9d685dc) >From f9d6bcdc606d28db5de42fcdeca55408979ddafb Mon Sep 17 00:00:00 2001 From: Ely Ronnen Date: Sun, 20 Apr 2025 17:07:09 +0200 Subject: [PATCH] fallback to assembly when source code is not available --- lldb/tools/lldb-dap/JSONUtils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 33f10c93d2ada..5b647950cfc6e 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -750,9 +750,11 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, EmplaceSafeString(object, "name", frame_name); auto line_entry = frame.GetLineEntry(); + auto file_spec = line_entry.GetFileSpec(); // A line entry of 0 indicates the line is compiler generated i.e. no source // file is associated with the frame. - if (line_entry.GetFileSpec().IsValid() && + if (file_spec.IsValid() && + file_spec.Exists() && (line_entry.GetLine() != 0 || line_entry.GetLine() != LLDB_INVALID_LINE_NUMBER)) { object.try_emplace("source", CreateSource(line_entry)); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Ely Ronnen (eronnen) Changes Show assembly code when the source code for a frame is not available in the debugger machine Fix #136492 After the fix: [Screencast From 2025-04-20 18-00-30.webm](https://github.com/user-attachments/assets/1ce41715-cf4f-42a1-8f5c-6196b9d685dc) --- Full diff: https://github.com/llvm/llvm-project/pull/136494.diff 1 Files Affected: - (modified) lldb/tools/lldb-dap/JSONUtils.cpp (+3-1) ``diff diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 33f10c93d2ada..5b647950cfc6e 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -750,9 +750,11 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, EmplaceSafeString(object, "name", frame_name); auto line_entry = frame.GetLineEntry(); + auto file_spec = line_entry.GetFileSpec(); // A line entry of 0 indicates the line is compiler generated i.e. no source // file is associated with the frame. - if (line_entry.GetFileSpec().IsValid() && + if (file_spec.IsValid() && + file_spec.Exists() && (line_entry.GetLine() != 0 || line_entry.GetLine() != LLDB_INVALID_LINE_NUMBER)) { object.try_emplace("source", CreateSource(line_entry)); `` https://github.com/llvm/llvm-project/pull/136494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
https://github.com/eronnen updated https://github.com/llvm/llvm-project/pull/136494 >From c7da2d8281823d689b85bc836f3ed947857aaa32 Mon Sep 17 00:00:00 2001 From: Ely Ronnen Date: Sun, 20 Apr 2025 17:07:09 +0200 Subject: [PATCH] fallback to assembly when source code is not available --- lldb/tools/lldb-dap/JSONUtils.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 33f10c93d2ada..1a44df7740639 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -750,9 +750,10 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, EmplaceSafeString(object, "name", frame_name); auto line_entry = frame.GetLineEntry(); + auto file_spec = line_entry.GetFileSpec(); // A line entry of 0 indicates the line is compiler generated i.e. no source // file is associated with the frame. - if (line_entry.GetFileSpec().IsValid() && + if (file_spec.IsValid() && file_spec.Exists() && (line_entry.GetLine() != 0 || line_entry.GetLine() != LLDB_INVALID_LINE_NUMBER)) { object.try_emplace("source", CreateSource(line_entry)); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fallback to assembly when source code is not available (PR #136494)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff HEAD~1 HEAD --extensions cpp -- lldb/tools/lldb-dap/JSONUtils.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 5b647950c..1a44df774 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -753,8 +753,7 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame, auto file_spec = line_entry.GetFileSpec(); // A line entry of 0 indicates the line is compiler generated i.e. no source // file is associated with the frame. - if (file_spec.IsValid() && - file_spec.Exists() && + if (file_spec.IsValid() && file_spec.Exists() && (line_entry.GetLine() != 0 || line_entry.GetLine() != LLDB_INVALID_LINE_NUMBER)) { object.try_emplace("source", CreateSource(line_entry)); `` https://github.com/llvm/llvm-project/pull/136494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits