binutils-gdb/gdb/testsuite/gdb.dap/step-out.c
Tom Tromey 2755241d02 Add return value to DAP scope
A bug report in the DAP specification repository pointed out that it
is typical for DAP implementations to put a function's return value
into the outermost scope.

This patch changes gdb to follow this convention.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31341
Reviewed-By: Kévin Le Gouguec <legouguec@adacore.com>
2024-03-08 10:50:13 -07:00

37 lines
931 B
C

/* Copyright 2024 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
struct result
{
int x;
};
struct result
function_breakpoint_here (int q)
{
struct result val;
val.x = q;
return val;
}
int
main ()
{
int q = 23;
return function_breakpoint_here (q).x - q;
}