[lldb-dev] SBDebugger CreateTarget question

Greg Clayton gclayton at apple.com
Thu Oct 9 10:42:54 PDT 2014


> On Oct 9, 2014, at 3:53 AM, Matthew Gardiner <mg11 at csr.com> wrote:
> 
> Hi,
> 
> I'm starting to play with the C++ API some more. I'm looking at target
> creation on the SBDebugger class:
> 
>    lldb::SBTarget
>    CreateTarget (const char *filename,
>                  const char *target_triple,
>                  const char *platform_name,
>                  bool add_dependent_modules,
>                  lldb::SBError& error);
> 
>    lldb::SBTarget
>    CreateTargetWithFileAndTargetTriple (const char *filename,
>                                         const char *target_triple);
> 
>    lldb::SBTarget
>    CreateTargetWithFileAndArch (const char *filename,
>                                 const char *archname);
> 
>    lldb::SBTarget
>    CreateTarget (const char *filename);
> 
> Out of the 4 methods of target creation, why has only one function got a
> mechanism to pass back an error?
> 
> How can I use the remaining 3 functions without such a scheme?

You should always use the first one that has the error. The other 3 that take less args were there before this first one and are there for legacy reasons. Just pass NULL (C++) or None (Python) for anything that you don't want to specify. We should mark the other three as deprecated. The test suite uses these all over the place which we can/should fix to use the first.

Greg



More information about the lldb-dev mailing list