Skip to content

Fix error message on failed target attach being discarded#124

Merged
sunshaoce merged 1 commit into
lldb-tools:mainfrom
iridinite:bugfix/attach-error
Sep 23, 2025
Merged

Fix error message on failed target attach being discarded#124
sunshaoce merged 1 commit into
lldb-tools:mainfrom
iridinite:bugfix/attach-error

Conversation

@iridinite

Copy link
Copy Markdown
Contributor

If the debugger fails to attach to the specified target, such as due to a permission error, then the error message is accidentally discarded. We create an empty SBStream on the stack, write nothing to it, and then use its (empty) contents as error message.

Instead, this PR removes the empty stream and instead passes the actual error message (as generated by lldb) to the formatted output string, so that it properly shows up in the MI output.

@sunshaoce

Copy link
Copy Markdown
Collaborator

Nice! Could you also add a test to ensure the error message isn’t empty?

@iridinite

Copy link
Copy Markdown
Contributor Author

@sunshaoce Hi, I don't seem to be able to run the tests on my dev machine:

CMake Warning at CMakeLists.txt:67 (message):
  Not supported on Windows due to a bug:
  https://gitlab.kitware.com/cmake/cmake/-/issues/22659.  Testing will be
  disabled.

nor do I see source for tests other than a couple for the String class. I'm not sure how to proceed. Could you help me out?

@sunshaoce sunshaoce left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lack of testing has always been our problem. I haven’t thought of a good solution for this, so let’s merge it first.

@sunshaoce sunshaoce merged commit 31ed003 into lldb-tools:main Sep 23, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants