Add "args" and "env" parameters to DAP launch request
This patch augments the DAP launch request with some optional new parameters that let the client control the command-line arguments and the environment of the inferior. Reviewed-By: Andrew Burgess <aburgess@redhat.com> Reviewed-By: Eli Zaretskii <eliz@gnu.org>
This commit is contained in:
parent
3153113252
commit
ea33730dfa
5 changed files with 178 additions and 12 deletions
|
@ -13,20 +13,36 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import gdb
|
||||
from .events import ExecutionInvoker
|
||||
from .server import request, capability
|
||||
from .startup import send_gdb
|
||||
from .startup import send_gdb, in_gdb_thread
|
||||
|
||||
|
||||
_program = None
|
||||
|
||||
|
||||
@in_gdb_thread
|
||||
def _set_args_env(args, env):
|
||||
inf = gdb.selected_inferior()
|
||||
inf.arguments = args
|
||||
if env is not None:
|
||||
inf.clear_env()
|
||||
for name, value in env.items():
|
||||
inf.set_env(name, value)
|
||||
|
||||
|
||||
# Any parameters here are necessarily extensions -- DAP requires this
|
||||
# from implementations. Any additions or changes here should be
|
||||
# documented in the gdb manual.
|
||||
@request("launch")
|
||||
def launch(*, program=None, **args):
|
||||
def launch(*, program=None, args=[], env=None, **extra):
|
||||
if program is not None:
|
||||
global _program
|
||||
_program = program
|
||||
send_gdb(f"file {_program}")
|
||||
if len(args) > 0 or env is not None:
|
||||
send_gdb(lambda: _set_args_env(args, env))
|
||||
|
||||
|
||||
@capability("supportsConfigurationDoneRequest")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue