This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Explicitly list User32 as dependency of lldb-mi
AbandonedPublic

Authored by xiaobai on Jan 15 2019, 12:41 PM.

Details

Summary

When building LLDB standalone on windows, lldb-mi fails to build
because it doesn't link against User32. This patch adds an explicit dependency
of lldb-mi on User32.

Event Timeline

xiaobai created this revision.Jan 15 2019, 12:41 PM
compnerd accepted this revision.Jan 15 2019, 2:39 PM

I personally prefer the use of target_link_libraries rather than the custom stuff added in the add_lldb_tool.

This revision is now accepted and ready to land.Jan 15 2019, 2:39 PM

Why do we need to link against user32? What kind of unresolved external are you getting?

@zturner: undefined symbol: __imp_MessageBoxA. Looks like MessageBoxA is used in the file tools/lldb-mi/MIUtilDebug.cpp, specifically in the function CMIUtilDebug::ShowDlgWaitForDbgAttach.

I personally prefer the use of target_link_libraries rather than the custom stuff added in the add_lldb_tool.

Sure, but the mechanism is already in place to handle this kind of thing.

It seems like a pretty bad idea to have lldb-mi show a dialog box :-/

I don't actually work on or have anything to do with lldb-mi though, but I don't know how well-maintained or supported it is these days anyway. But if nobody chimes in and says why this is important to have, I would just assume delete the line.

It seems like a pretty bad idea to have lldb-mi show a dialog box :-/

I don't actually work on or have anything to do with lldb-mi though, but I don't know how well-maintained or supported it is these days anyway. But if nobody chimes in and says why this is important to have, I would just assume delete the line.

It looks like this functionality has been available since lldb-mi was committed. I'd rather fix the build than modify the functionality not knowing if somebody actually values this behavior. Based on commit logs it looks like there is some amount of work that was done on lldb-mi last year, but I'm not really sure how much people care about lldb-mi honestly.

As far as I can tell, this dialog is only used when you build the lldb-mi with MICONFIG_DEBUG_SHOW_ATTACH_DBG_DLG, which you would only do if you wanted to debug lldb-mi. The point is to stall the lldb-mi launch at an early point till you've gotten a debugger attached to it. Then you can click the MessageBox OK to let lldb-mi proceed. On all the other systems it does a while (var) sleep; type thing, so you attach and change the value of var with the expression parser and continue.

While the MessageBox implementation is cute, setting the var value should work just as well. It certainly doesn't seem worth dragging UI into lldb-mi just for this purpose.

As far as I can tell, this dialog is only used when you build the lldb-mi with MICONFIG_DEBUG_SHOW_ATTACH_DBG_DLG, which you would only do if you wanted to debug lldb-mi. The point is to stall the lldb-mi launch at an early point till you've gotten a debugger attached to it. Then you can click the MessageBox OK to let lldb-mi proceed. On all the other systems it does a while (var) sleep; type thing, so you attach and change the value of var with the expression parser and continue.

While the MessageBox implementation is cute, setting the var value should work just as well. It certainly doesn't seem worth dragging UI into lldb-mi just for this purpose.

Okay, in that case I'll go ahead and remove it like Zach originally suggested then. Thanks for taking a look.

That seems right. TTTT, IME on a decently fast Linux or macOS machine "attach -w" will get lldb attached to the process way before it would have gotten this far, so I'm not sure how useful this convenience is altogether. But maybe "attach -w" is slower on Windows.

xiaobai abandoned this revision.Jan 15 2019, 4:03 PM

Abandoned in favor of D56755.