This is an archive of the discontinued LLVM Phabricator instance.

[SBAPI] Log from record macro
ClosedPublic

Authored by JDevlieghere on Mar 7 2019, 10:43 AM.

Details

Summary

The current record macros already log the function being called. This patch extends the macros to also log their input arguments and removes explicit logging from the SB API.

This might degrade the amount of information in some cases (because of smarter casts or efforts to log return values). However I think this is outweighed by the increased coverage and consistency. Furthermore, using the reproducer infrastructure, diagnosing bugs in the API layer should become much easier compared to relying on log messages.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

JDevlieghere created this revision.Mar 7 2019, 10:43 AM

As long as we are still seeing all argument values, I check the first 10 or so calls and it looked like this was the case, then I am good with this.

As long as we are still seeing all argument values, I check the first 10 or so calls and it looked like this was the case, then I am good with this.

Correct, the macros forward the arguments to the log.

This revision was not accepted when it landed; it landed in state Needs Review.Mar 7 2019, 2:46 PM
This revision was automatically updated to reflect the committed changes.

I'm getting build failures that appear to be caused by this patch. I'm compiling on macOS with Xcode 10.1. The failures are uses of LLDB_RECORD_DUMMY(), passing a callback function pointer as one of the args. This results in errors like:

../../tools/lldb/include/lldb/Utility/ReproducerInstrumentation.h:37:6: error: invalid operands to binary expression ('llvm::raw_string_ostream' and 'bool (*)(void *, lldb::SBProcess &, lldb::SBThread &, lldb::SBBreakpointLocation &)')
  ss << t;
  ~~ ^  ~

and

../../include/llvm/Support/raw_ostream.h:202:16: note: candidate function not viable: no known conversion from 'bool (*)(void *, lldb::SBProcess &, lldb::SBThread &, lldb::SBBreakpointLocation &)' to 'const void *' for 1st argument; take the address of the argument with &
  raw_ostream &operator<<(const void *P);