This is an archive of the discontinued LLVM Phabricator instance.

[lldb-vsocde] Adding support for the "disassemble" request.
ClosedPublic

Authored by ashgti on Jul 27 2023, 3:26 PM.

Details

Summary

Instead of creating psuedo source files for each stack frame this change adopts the new DAP “disassemble” request, allowing clients to inspect assembly instructions of files with debug info in addition to files without debug info.

spec

See attached screenshot of the disassembly view.

Diff Detail

Event Timeline

ashgti created this revision.Jul 27 2023, 3:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2023, 3:26 PM
ashgti requested review of this revision.Jul 27 2023, 3:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2023, 3:26 PM
ashgti updated this revision to Diff 544957.Jul 27 2023, 3:29 PM

Minor fix.

ashgti edited the summary of this revision. (Show Details)Jul 27 2023, 3:30 PM
ashgti added a reviewer: wallace.
ashgti edited the summary of this revision. (Show Details)Jul 27 2023, 3:37 PM
ashgti updated this revision to Diff 544977.Jul 27 2023, 4:19 PM

Fixing a test and removing dead code.

ashgti updated this revision to Diff 544982.Jul 27 2023, 5:18 PM

Adding new tests to cover the behavior of the disassemble request.

wallace accepted this revision.Jul 28 2023, 7:57 AM

you are my hero

This revision is now accepted and ready to land.Jul 28 2023, 7:57 AM

I have no excuse to not try vcsode with lldb now, thanks for working on this!

ashgti updated this revision to Diff 545278.Jul 28 2023, 2:13 PM

Adjusting the unit test to only check 2 frames instead of 3 and adjusted the assertions.

This revision was automatically updated to reflect the committed changes.

I've marked one of these tests skipped on Arm because it's failing on our bot: https://github.com/llvm/llvm-project/commit/54458c525aa47219a3ef2bee2be33d6096b1585c

This is a 32 Arm machine, so unless you've got ready access to one, we'll figure out what the problem is. Other tests in this change may also be failing, but I'll see what the bot thinks of this first skip.

DavidSpickett added a comment.EditedAug 2 2023, 7:49 AM

Also it would be very useful if the logs could be printed in a pretty form like:

>>> from pprint import pprint
>>> pprint(j)
{u'body': {u'instructions': [{u'address': u'0x400584',
                              u'column': 9,
                              u'instruction': u'    ldr r0, [sp, #0x4]',
                              u'instructionBytes': u'04 00 9d e5',
                              u'line': 12,
                              u'location': {u'name': u'main.c',
                                            u'path': u'/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/tools/lldb-vscode/disassemble/main.c'}},
                             {u'address': u'0x400588',
                              u'column': 16,
                              u'instruction': u'    ldr     r1, [sp]',
                              u'instructionBytes': u'00 10 9d e5',
                              u'line': 12,
                              u'location': {u'name': u'main.c',
                                            u'path': u'/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/tools/lldb-vscode/disassemble/main.c'}},

Probably only want to do that when we've had a failure and not waste time otherwise, but it would be a lot more readable in the test output.

ashgti added a comment.Aug 2 2023, 9:44 AM

Do you have any additional information about the failure? The link looks like a timeout, so I'm not sure where things are timing out.

It's failing the test, but actually it looks like a cleanup step is failing. Whether that is also the timeout I don't know. I will restart the machine to rule out any lingering processes and get back to you.

Also it would be very useful if the logs could be printed in a pretty form like:

And I'll have a patch for this shortly.

Do you have any additional information about the failure? The link looks like a timeout, so I'm not sure where things are timing out.

Sorry for the false alarm, https://github.com/llvm/llvm-project/commit/9a3f0cd717f68ccf9e348bce2d76a2372482f4f2 fixed a few vscode tests including this one. I've enabled it again.

Also it would be very useful if the logs could be printed in a pretty form like:

And I've done this in https://github.com/llvm/llvm-project/commit/165f45a877742a74988d63f36aee635c8e0a47da.

lldb/tools/lldb-vscode/JSONUtils.cpp