LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 14437 - Evaluating expressions that contain function calls is broken on Linux
Summary: Evaluating expressions that contain function calls is broken on Linux
Status: RESOLVED FIXED
Alias: None
Product: lldb
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: LLDB commit list
URL:
Keywords:
: 14595 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-11-26 15:34 PST by Daniel Malea
Modified: 2020-11-04 11:32 PST (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Malea 2012-11-26 15:34:04 PST
Attempting to evaluate an expression that contains a function call is broken on Linux.

Sometimes, the expression is evaluated but the result is clearly incorrect:
(lldb) expression -- (int)strlen("hello world")
(int) $5 = -764888112

To reproduce the above, run: python dotest.py -i -v lang/c/strings


Sometimes, the expression command itself returns an error:
(lldb) print str.c_str()

To reproduce the above, run: python dotest.py -i -v expression_command/call-function
Comment 1 Ashok Thirumurthi 2012-12-13 13:28:20 PST
*** Bug 14595 has been marked as a duplicate of this bug. ***
Comment 2 Ashok Thirumurthi 2012-12-13 13:49:49 PST
The failure to print str.c_str generates the following lldb error message:
  error: Execution was interrupted, reason: invalid address.

This can also be reproduced with:
  (lldb) expr new int(12)

which is also run by the following test case:
  python dotest.py -i -v expression_command/call-function

(lldb) log enable lldb expr
The logging facility includes the following output, whereas a non-null remote
address is typical of successful expression evaluation: 
  Code can be run in the target.
  Found function, has local address 0x7fab3bc01008 and remote address 0x0
  Function's code range is [0x0+0x5e]
  Couldn't disassemble function : Couldn't read from process: Input/output
error
  Data buffer contents:
Comment 3 Daniel Malea 2013-02-15 13:33:37 PST
In latest trunk (r175255) I can confirm that expressions with 'new' work. Re-enabling TestFormatters.py.

Leaving this bug open as there's more work needed to fix expression evaluation on Linux.
Comment 4 labath 2015-09-01 04:32:15 PDT
This bug has been fixed since it was first filed.