GithubHelp home page GithubHelp logo

Comments (7)

gregg-miskelly avatar gregg-miskelly commented on July 29, 2024 1

CC @andrewcrawley

My suggested documentation: Ids are valid until the next continue. If multiple GotoTargetsRequest are issued by a client, the debug adapter is allowed, but not required, to return the same id if the underlying execution location is the same between the two requests.

from debug-adapter-protocol.

gregg-miskelly avatar gregg-miskelly commented on July 29, 2024 1

I am not sure why a client might want to issue multiple gotoTargets requests, but it also seems wrong not to handle them -- the DAP uses handles in lots of other places, so I don't know why an adapter would do things differently here.

GotoTargetsArguments doesn't specify a thread id, so I don't think an adapter could actually know which template instantiation to return.

line in GotoTarget is useful for the same reason as in breakpoints - the incoming line is where the user requested. But the debug adapter may find that it doesn't have an executable code associated with that line, but it does have executable code associated with lines in close proximity. An IDE could then choose to use that line info in a disambiguation dialog.

FYI: If you are asking about this because you are thinking about implementing this in MIEngine, GotoTargets needs to call IDebugProgram2.EnumCodeContexts.

from debug-adapter-protocol.

Trass3r avatar Trass3r commented on July 29, 2024

Could someone explain a use-case for doing multiple GotoTargetsRequests in a row?
VSCode just issues 1 targets request and directly feeds the id into the goto request for its Jump to Cursor functionality, ignoring anything else inside the GotoTarget: debugCommands.ts
This adapter already relies on this by returning a dummy GotoTarget with id 1 and the same source line given in the request and then simply remembers the last requested target.

I can barely come up with an example for returning more than 1 target (template functions come to mind but why would it be ambiguous if you are already in the same function) let alone multiple target requests.
Also I don't know what the other GotoTarget fields could be useful for (line? we already requested a specific line).

from debug-adapter-protocol.

Trass3r avatar Trass3r commented on July 29, 2024

I am not sure why a client might want to issue multiple gotoTargets requests, but it also seems wrong not to handle them -- the DAP uses handles in lots of other places, so I don't know why an adapter would do things differently here.

I guess confusion about the spec like in this ticket, vscode as the reference implementation does it as described above and it makes the implementation much easier (at least if you assume IDs need to be globally unique, that crucial 'certain IDs are valid only until the next continue' information is buried in some tickets on Github, see #60).

GotoTargetsArguments doesn't specify a thread id, so I don't think an adapter could actually know which template instantiation to return.

Interesting. Related to #38.
Any other use-case for multiple locations?

line in GotoTarget is useful for the same reason as in breakpoints - the incoming line is where the user requested. But the debug adapter may find that it doesn't have an executable code associated with that line, but it does have executable code associated with lines in close proximity.

I see, should be added to the docs.

from debug-adapter-protocol.

gregg-miskelly avatar gregg-miskelly commented on July 29, 2024

Any other use-case for multiple locations?

For compiled languages, I think of the gotoTargets request as akin to asking: "if I was to set a breakpoint on this line, where would the breakpoint mind?" without actually setting the breakpoint. So you could get multiple answers if:

  • The function was compiled multiple times (ex: C++ templates)
  • The line was mapped to multiple instruction groups (ex: optimizations, compiler bugs, for loops in C-like languages, etc)
  • The method was included in multiple modules (ex: inline function defined in C/C++ header file)
  • Potentially a managed runtime might JIT a method multiple times (ex: fast JIT and optimizing JIT) and expose that

from debug-adapter-protocol.

Trass3r avatar Trass3r commented on July 29, 2024

Yeah it's easy to handle breakpoints as for example gdb just sets 1 per associated address. But jump will probably fail if it's ambiguous.

from debug-adapter-protocol.

Trass3r avatar Trass3r commented on July 29, 2024

I am not sure why a client might want to issue multiple gotoTargets requests

If you want to implement jumping by dragging the current line marker like in VS you'd probably have to do that.
But even then that simple approach of remembering the last request would still work as long as the UI doesn't do caching.

from debug-adapter-protocol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.