Bug 30691

Summary: Implement "source" request
Product: gdb Reporter: Tom Tromey <tromey>
Component: dapAssignee: Tom Tromey <tromey>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: HEAD   
Target Milestone: 14.1   
Host: Target:
Build: Last reconfirmed:

Description Tom Tromey 2023-07-27 17:09:15 UTC
The DAP "source" request tells gdb to send the text of a source file.
This would be handy for the scenario where an IDE launches gdb
on some remote machine.

To implement this, we'd need to fix up a couple of spots
that specify "sourceReference": 0, and also at least one
spot (loadedSources request) that doesn't specify this at all.

We'd probably also need a Python API to something like find_and_open_source.
Comment 1 Tom Tromey 2023-07-27 20:27:20 UTC
I went ahead and implemented this.
Comment 3 Sourceware Commits 2023-08-01 19:15:56 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=13bd1a9175962980a3b0f1c0598698858c72fc04

commit 13bd1a9175962980a3b0f1c0598698858c72fc04
Author: Tom Tromey <tromey@adacore.com>
Date:   Thu Jul 27 14:27:05 2023 -0600

    Implement DAP "source" request
    
    This implements the DAP "source" request.  I renamed the
    "loadedSources" function from "sources" to "loaded_sources" to avoid
    any confusion.  I also moved the loadedSources test to the new
    sources.exp.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30691
Comment 4 Tom Tromey 2023-08-01 19:16:43 UTC
Fixed.