[Bug 23248] New: "stopped" notification for the exec-finish GDB/MI command gives the wrong reason

Bug ID 23248
Summary “stopped” notification for the exec-finish GDB/MI command gives the wrong reason
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter vadim.macagon@gmail.com
Classification Unclassified

Created attachment 14209 [details]
Source for test executable

The -exec-finish MI command is used to step out of the current function (see
<[https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Program-Execution.html#GDB_002fMI-Program-Execution](https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Program-Execution.html#GDB_002fMI-Program-Execution)>).
When this command completes and execution stops GDB sends out:

*stopped,reason="function-finished"...

However the LLDB MI driver sends out:

*stopped,reason="end-stepping-range"...

Furthermore, GDB sends the return value of the function in the notification
(unless the function returns void) while the LLDB MI driver does not. Here's a
sample notification sent out when stepping out of a function that returns an
int.

GDB-MI:
*stopped,reason="function-finished",frame={addr="0x0000000000400828",func="printNextInt",args=[],file="../test/test_target.cpp",fullname="/media/sf_dbgmits/test/test_target.cpp",line="11"},gdb-result-var="$1",return-value="0",thread-id="1",stopped-threads="all",core="0"

LLDB-MI:
*stopped,reason="end-stepping-range",frame={addr="0x0000000000400828",func="printNextInt()",args=[],file="test_target.cpp",fullname="/media/sf_dbgmits/build/../test/test_target.cpp",line="11"},thread-id="1",stopped-threads="all"

I've attached the source file of the program I've used for testing, once built
the above notifications can be obtained by launching LLDB-MI (lldb-mi
--interpreter) or GDB-MI (gdb --interpreter mi) and entering the following
commands:
-file-exec-and-symbols path/to/test_target
-break-insert getNextInt
-exec-run
-exec-finish

GDB: GNU gdb (Ubuntu 7.8-1ubuntu4) 7.8.0.20141001-cvs
LLDB: lldb version 3.7.0 ([https://github.com/llvm-mirror/lldb.git](https://github.com/llvm-mirror/lldb.git)
revision 8733ed3778e9787602521c4b1f491d7da6eb5b04 
clang revision 13756eaa7c29673267fd20651a56883335dca123
llvm revision 2c5bf601c34780d431cf652e436ef39030ff9213)

Vadim Macagon changed bug 23248

What | Removed | Added |

Comment # 1 on bug 23248 from Vadim Macagon

I'll try fixing this one myself.

Vadim Macagon changed bug 23248