[Lldb-commits] [PATCH] D24495: A little bit more pointer safety in the Breakpoint code

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 12 23:06:12 PDT 2016


zturner created this revision.
zturner added a reviewer: jingham.
zturner added subscribers: lldb-commits, LLDB.

This started out when I noticed a potential pitfall in the API of `SetCallback` where you could potentially get the class into a bad state.  Ultimately I wasn't able to fix that in this patch, although I did include a comment in this patch explaining the problem and some possible fixes.  But my initial attempts to fix it before I decided that the best approach wasn't clear ended up in this patch, which I think is still a net positive, so I'm uploading it anyway.

Basically, it makes the `Baton` classes a little bit more type-safe by plumbing `unique_ptrs` through a few more places so that you never have to deal with raw pointers, and it also makes it so Batons can clean up after themselves by default, so anyone implementing a new baton doesn't have to reimplement the exact same code in the destructor every time.

Also fixes a compiler error since SIZE_T_MAX isn't defined.

https://reviews.llvm.org/D24495

Files:
  include/lldb/Breakpoint/BreakpointOptions.h
  include/lldb/Breakpoint/WatchpointOptions.h
  include/lldb/Core/Baton.h
  source/API/SBBreakpoint.cpp
  source/Breakpoint/Breakpoint.cpp
  source/Breakpoint/BreakpointLocation.cpp
  source/Breakpoint/BreakpointOptions.cpp
  source/Breakpoint/Watchpoint.cpp
  source/Breakpoint/WatchpointOptions.cpp
  source/Commands/CommandObjectBreakpointCommand.cpp
  source/Commands/CommandObjectWatchpointCommand.cpp
  source/Core/Baton.cpp
  source/Core/StructuredData.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24495.71110.patch
Type: text/x-patch
Size: 15205 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160913/88d2f272/attachment.bin>


More information about the lldb-commits mailing list