Re: [lldb-dev] RFC: Break/Watchpoint Callback storage and validation

2016-09-30 Thread Zachary Turner via lldb-dev
On Thu, Sep 29, 2016 at 5:34 PM Daniel Austin Noland via lldb-dev <
lldb-dev@lists.llvm.org> wrote:

> As per discussion in another thread
>
> (http://lists.llvm.org/pipermail/lldb-dev/2016-September/011397.html)
>
> I have started refactoring the private side of Break/Watchpoint.
>
> Mostly this involves fairly trivial and obvious changes and I expect the
> first patch to be ready fairly soon.
>
> Still, there are a couple points I would like to get feedback on.
>
> 1. Having reviewed the llvm::function_ref template (see
> http://llvm.org/docs/doxygen/html/STLExtras_8h_source.html#l00059), I
> can tentatively agree that it is suitable for break/watch callbacks.
>
> The concern is the "This class does not own the callable, so it is not
> in general safe to store a function_ref" bit.  This is not an issue
> provided I ensure that
>
> a) StoppointOptions does "own" the callable OR ensures its validity
> prior to invoking the callback
>
> AND
>
> b) ~StoppointOptions behaves responsibly in the face of this provision
>
> If we are just handed a function pointer then there is nothing to clean up.
>
> If we are handed a callable object things are a little more complex.
>
> We could make a copy of the provided object and just let the dtors clean
> up for us. That does put a few restrictions on the type of callback
> objects we can accept (e.g. user must account for side effects in
> ctor/dtors, object must be copy constructible, performance and memory
> overhead).
>
> We could require move semantics.
>
> We could use unique_ptr, shared_ptr, weak_ptr.
>
> Feelings?
>
> 2. llvm::function_ref and std::function are great, but they accept ANY
> callable.
>
> When I write templates I generally write helper classes which try to
> validate the template params.
>
> Here is a simple sketch of the type of thing I mean:
>
> ```cpp
>
> #include 
> namespace callback {
>
> template 
> struct IsReturnTypeValid {
>static constexpr bool value = false;
> };
>
> template 
> struct IsReturnTypeValid {
>static constexpr bool value = std::is_same<
>  typename std::remove_const::type,
>  bool
>   >::value;
> };
>
> template 
> constexpr
> void assert_valid_callback() {
>static_assert(IsReturnTypeValid::value,
>  "Return type of Stoppoint callback must be bool!");
> }
>
> } // end namespace ::callback
>
>
> bool valid(void* userData, int some, double other, char params) {
>return true;
> }
>
>
> double invalid(int stuff, double moreStuff) {
>return 0;
> }
>
> int main(void) {
>
>// compiles
>
>callback::assert_valid_callback();
>// will not compile
>
>callback::assert_valid_callback();
>return 0;
> }
> ```
>
> I find that the makes debugging far easier for people using the library.
>
> This seems unnecessary.  If you've got an llvm::function_ref then it's simply not going to compile if you pass it a
mismatched callable.  Is this not sufficient?
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


[lldb-dev] [Bug 30580] New: lldb fails to link when -fvisibility=hidden used

2016-09-30 Thread via lldb-dev
https://llvm.org/bugs/show_bug.cgi?id=30580

Bug ID: 30580
   Summary: lldb fails to link when -fvisibility=hidden used
   Product: lldb
   Version: 3.9
  Hardware: PC
OS: All
Status: NEW
  Severity: normal
  Priority: P
 Component: All Bugs
  Assignee: lldb-dev@lists.llvm.org
  Reporter: d...@mapbox.com
CC: llvm-b...@lists.llvm.org
Classification: Unclassified

The entire llvm project builds and links okay with `-fvisibility=hidden` except
lldb. If this flag is used with `lldb` then linking errors break the build:
https://gist.github.com/springmeyer/b1613366c32660ce26a847270e3dd4df.

Ideally the lldb code would be able to be built with `-fvisibility=hidden`. The
advantage of this is that the lldb binaries would be smaller.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


[lldb-dev] [IMPORTANT] llvm.org downtime

2016-09-30 Thread Tanya Lattner via lldb-dev
All,

llvm.org  will be unreachable on Sunday, October 2 from 
3:00AM CDT to 7:00AM CDT in order to perform network upgrades.

Thanks,
Tanya Lattner

___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev