<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="gmail-im" style="color:rgb(80,0,80);font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">> There was no way to find out what's wrong if SBProcess SBTarget::LoadCore(const char *core_file) failed.<span> </span><br>> Additionally, the implementation was unconditionally setting sb_process, so it wasn't even possible to check if the return SBProcess is valid.<br><br></span><span style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Not terribly important, but:</span><br style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">>>> process = lldb.target.LoadCore("/not/</span><wbr style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">here/no_core")</span><br style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">>>> process.IsValid()</span><br style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">False</span><br style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Pretty much all the SB objects have an IsValid method to test whether the call that made them was successful or not. But IsValid doesn't specify the reason why the call didn't work, so having an error parameter is still a good thing.</span></blockquote><div><br></div><div>True. In this case the SBTarget::LoadCore() implementation had a bug though, which was causing it to return a "valid" process even on some failure situations (when the actual Process::LoadCore() failed).</div><div><br></div><div>Full context in the change diff, but the key part is:</div><div><br></div><div>...</div><div><div> if (process_sp) {</div><div> error.SetError(process_sp->LoadCore());</div><div> <b> if (error.Success()) <font color="#ff0000">// this was missing</font></b></div><div> sb_process.SetSP(process_sp);</div><div> }</div></div><div>...</div><div><br></div><div>Beyond this small fix, I also wanted the actual error for external diagnostic purposes (for example it's valuable to know what was the actual problem: corrupted, truncated or unsupported minidump, etc.)</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 11, 2018 at 5:47 PM, Jim Ingham <span dir="ltr"><<a href="mailto:jingham@apple.com" target="_blank">jingham@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
> On Jun 11, 2018, at 2:19 PM, Leonard Mosescu via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org">lldb-commits@lists.llvm.org</a>> wrote:<br>
> <br>
> Author: lemo<br>
> Date: Mon Jun 11 14:19:26 2018<br>
> New Revision: 334439<br>
> <br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=334439&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=334439&view=rev</a><br>
> Log:<br>
> Add a new SBTarget::LoadCore() overload which surfaces errors if the load fails<br>
> <br>
> There was no way to find out what's wrong if SBProcess SBTarget::LoadCore(const char *core_file) failed. <br>
> Additionally, the implementation was unconditionally setting sb_process, so it wasn't even possible to check if the return SBProcess is valid.<br>
<br>
</span>Not terribly important, but:<br>
<br>
>>> process = lldb.target.LoadCore("/not/<wbr>here/no_core")<br>
>>> process.IsValid()<br>
False<br>
<br>
Pretty much all the SB objects have an IsValid method to test whether the call that made them was successful or not. But IsValid doesn't specify the reason why the call didn't work, so having an error parameter is still a good thing.<br>
<span class="HOEnZb"><font color="#888888"><br>
Jim<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
> <br>
> This change adds a new overload which surfaces the errors and also returns a valid SBProcess only if the core load succeeds:<br>
> <br>
> SBProcess SBTarget::LoadCore(const char *core_file, SBError &error);<br>
> <br>
> Differential Revision: <a href="https://reviews.llvm.org/D48049" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D48049</a><br>
> <br>
> <br>
> Modified:<br>
> lldb/trunk/include/lldb/API/<wbr>SBTarget.h<br>
> lldb/trunk/packages/Python/<wbr>lldbsuite/test/<wbr>functionalities/postmortem/<wbr>minidump-new/TestMiniDumpNew.<wbr>py<br>
> lldb/trunk/scripts/interface/<wbr>SBTarget.i<br>
> lldb/trunk/source/API/<wbr>SBTarget.cpp<br>
> <br>
> Modified: lldb/trunk/include/lldb/API/<wbr>SBTarget.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=334439&r1=334438&r2=334439&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lldb/trunk/include/<wbr>lldb/API/SBTarget.h?rev=<wbr>334439&r1=334438&r2=334439&<wbr>view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- lldb/trunk/include/lldb/API/<wbr>SBTarget.h (original)<br>
> +++ lldb/trunk/include/lldb/API/<wbr>SBTarget.h Mon Jun 11 14:19:26 2018<br>
> @@ -165,6 +165,7 @@ public:<br>
> bool stop_at_entry, lldb::SBError &error);<br>
> <br>
> SBProcess LoadCore(const char *core_file);<br>
> + SBProcess LoadCore(const char *core_file, lldb::SBError &error);<br>
> <br>
> //----------------------------<wbr>------------------------------<wbr>--------<br>
> /// Launch a new process with sensible defaults.<br>
> @@ -718,9 +719,9 @@ public:<br>
> // Finds all breakpoints by name, returning the list in bkpt_list. Returns<br>
> // false if the name is not a valid breakpoint name, true otherwise.<br>
> bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list);<br>
> - <br>
> +<br>
> void GetBreakpointNames(<wbr>SBStringList &names);<br>
> - <br>
> +<br>
> void DeleteBreakpointName(const char *name);<br>
> <br>
> bool EnableAllBreakpoints();<br>
> <br>
> Modified: lldb/trunk/packages/Python/<wbr>lldbsuite/test/<wbr>functionalities/postmortem/<wbr>minidump-new/TestMiniDumpNew.<wbr>py<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py?rev=334439&r1=334438&r2=334439&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lldb/trunk/packages/<wbr>Python/lldbsuite/test/<wbr>functionalities/postmortem/<wbr>minidump-new/TestMiniDumpNew.<wbr>py?rev=334439&r1=334438&r2=<wbr>334439&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- lldb/trunk/packages/Python/<wbr>lldbsuite/test/<wbr>functionalities/postmortem/<wbr>minidump-new/TestMiniDumpNew.<wbr>py (original)<br>
> +++ lldb/trunk/packages/Python/<wbr>lldbsuite/test/<wbr>functionalities/postmortem/<wbr>minidump-new/TestMiniDumpNew.<wbr>py Mon Jun 11 14:19:26 2018<br>
> @@ -59,6 +59,24 @@ class MiniDumpNewTestCase(TestBase):<br>
> self.dbg.SetOutputFileHandle(<wbr>None, False)<br>
> self.dbg.SetErrorFileHandle(<wbr>None, False)<br>
> <br>
> + def test_loadcore_error_status(<wbr>self):<br>
> + """Test the SBTarget.LoadCore(core, error) overload."""<br>
> + self.dbg.CreateTarget(None)<br>
> + self.target = self.dbg.GetSelectedTarget()<br>
> + error = lldb.SBError()<br>
> + self.process = self.target.LoadCore("linux-<wbr>x86_64.dmp", error)<br>
> + self.assertTrue(self.process, PROCESS_IS_VALID)<br>
> + self.assertTrue(error.Success(<wbr>))<br>
> +<br>
> + def test_loadcore_error_status_<wbr>failure(self):<br>
> + """Test the SBTarget.LoadCore(core, error) overload."""<br>
> + self.dbg.CreateTarget(None)<br>
> + self.target = self.dbg.GetSelectedTarget()<br>
> + error = lldb.SBError()<br>
> + self.process = self.target.LoadCore("non-<wbr>existent.dmp", error)<br>
> + self.assertFalse(self.process, PROCESS_IS_VALID)<br>
> + self.assertTrue(error.Fail())<br>
> +<br>
> def test_process_info_in_minidump(<wbr>self):<br>
> """Test that lldb can read the process information from the Minidump."""<br>
> # target create -c linux-x86_64.dmp<br>
> <br>
> Modified: lldb/trunk/scripts/interface/<wbr>SBTarget.i<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBTarget.i?rev=334439&r1=334438&r2=334439&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lldb/trunk/scripts/<wbr>interface/SBTarget.i?rev=<wbr>334439&r1=334438&r2=334439&<wbr>view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- lldb/trunk/scripts/interface/<wbr>SBTarget.i (original)<br>
> +++ lldb/trunk/scripts/interface/<wbr>SBTarget.i Mon Jun 11 14:19:26 2018<br>
> @@ -77,7 +77,7 @@ public:<br>
> <br>
> static const char *<br>
> GetBroadcasterClassName ();<br>
> - <br>
> +<br>
> bool<br>
> IsValid() const;<br>
> <br>
> @@ -145,7 +145,7 @@ public:<br>
> /// An optional listener that will receive all process events.<br>
> /// If \a listener is valid then \a listener will listen to all<br>
> /// process events. If not valid, then this target's debugger<br>
> - /// (SBTarget::GetDebugger()) will listen to all process events. <br>
> + /// (SBTarget::GetDebugger()) will listen to all process events.<br>
> ///<br>
> /// @param[in] argv<br>
> /// The argument array.<br>
> @@ -175,7 +175,7 @@ public:<br>
> /// The working directory to have the child process run in<br>
> ///<br>
> /// @param[in] launch_flags<br>
> - /// Some launch options specified by logical OR'ing <br>
> + /// Some launch options specified by logical OR'ing<br>
> /// lldb::LaunchFlags enumeration values together.<br>
> ///<br>
> /// @param[in] stop_at_entry<br>
> @@ -203,7 +203,7 @@ public:<br>
> run to completion if no user interaction is required.<br>
> ") Launch;<br>
> lldb::SBProcess<br>
> - Launch (SBListener &listener, <br>
> + Launch (SBListener &listener,<br>
> char const **argv,<br>
> char const **envp,<br>
> const char *stdin_path,<br>
> @@ -213,7 +213,7 @@ public:<br>
> uint32_t launch_flags, // See LaunchFlags<br>
> bool stop_at_entry,<br>
> lldb::SBError& error);<br>
> - <br>
> +<br>
> %feature("docstring", "<br>
> //----------------------------<wbr>------------------------------<wbr>--------<br>
> /// Launch a new process with sensible defaults.<br>
> @@ -250,10 +250,10 @@ public:<br>
> executable.<br>
> ") LaunchSimple;<br>
> lldb::SBProcess<br>
> - LaunchSimple (const char **argv, <br>
> + LaunchSimple (const char **argv,<br>
> const char **envp,<br>
> const char *working_directory);<br>
> - <br>
> +<br>
> lldb::SBProcess<br>
> Launch (lldb::SBLaunchInfo &launch_info, lldb::SBError& error);<br>
> <br>
> @@ -264,6 +264,10 @@ public:<br>
> /// @param[in] core_file<br>
> /// File path of the core dump.<br>
> ///<br>
> + /// @param[out] error<br>
> + /// An error explaining what went wrong if the operation fails.<br>
> + /// (Optional)<br>
> + ///<br>
> /// @return<br>
> /// A process object for the newly created core file.<br>
> //----------------------------<wbr>------------------------------<wbr>--------<br>
> @@ -276,10 +280,12 @@ public:<br>
> ") LoadCore;<br>
> lldb::SBProcess<br>
> LoadCore(const char *core_file);<br>
> - <br>
> +<br>
> lldb::SBProcess<br>
> - Attach (lldb::SBAttachInfo &attach_info, lldb::SBError& error);<br>
> - <br>
> + LoadCore(const char *core_file, lldb::SBError &error);<br>
> +<br>
> + lldb::SBProcess<br>
> + Attach(lldb::SBAttachInfo &attach_info, lldb::SBError& error);<br>
> <br>
> %feature("docstring", "<br>
> //----------------------------<wbr>------------------------------<wbr>--------<br>
> @@ -363,7 +369,7 @@ public:<br>
> const char *url,<br>
> const char *plugin_name,<br>
> SBError& error);<br>
> - <br>
> +<br>
> lldb::SBFileSpec<br>
> GetExecutable ();<br>
> <br>
> @@ -401,10 +407,10 @@ public:<br>
> <br>
> lldb::ByteOrder<br>
> GetByteOrder ();<br>
> - <br>
> +<br>
> uint32_t<br>
> GetAddressByteSize();<br>
> - <br>
> +<br>
> const char *<br>
> GetTriple ();<br>
> <br>
> @@ -457,21 +463,21 @@ public:<br>
> /// A logical OR of one or more FunctionNameType enum bits that<br>
> /// indicate what kind of names should be used when doing the<br>
> /// lookup. Bits include fully qualified names, base names,<br>
> - /// C++ methods, or ObjC selectors. <br>
> + /// C++ methods, or ObjC selectors.<br>
> /// See FunctionNameType for more details.<br>
> ///<br>
> /// @return<br>
> - /// A lldb::SBSymbolContextList that gets filled in with all of <br>
> + /// A lldb::SBSymbolContextList that gets filled in with all of<br>
> /// the symbol contexts for all the matches.<br>
> //----------------------------<wbr>------------------------------<wbr>--------<br>
> ") FindFunctions;<br>
> lldb::SBSymbolContextList<br>
> - FindFunctions (const char *name, <br>
> + FindFunctions (const char *name,<br>
> uint32_t name_type_mask = lldb::eFunctionNameTypeAny);<br>
> - <br>
> +<br>
> lldb::SBType<br>
> FindFirstType (const char* type);<br>
> - <br>
> +<br>
> lldb::SBTypeList<br>
> FindTypes (const char* type);<br>
> <br>
> @@ -497,7 +503,7 @@ public:<br>
> //----------------------------<wbr>------------------------------<wbr>--------<br>
> ") FindGlobalVariables;<br>
> lldb::SBValueList<br>
> - FindGlobalVariables (const char *name, <br>
> + FindGlobalVariables (const char *name,<br>
> uint32_t max_matches);<br>
> <br>
> %feature("docstring", "<br>
> @@ -515,7 +521,7 @@ public:<br>
> lldb::SBValue<br>
> FindFirstGlobalVariable (const char* name);<br>
> <br>
> - <br>
> +<br>
> lldb::SBValueList<br>
> FindGlobalVariables(const char *name,<br>
> uint32_t max_matches,<br>
> @@ -544,26 +550,26 @@ public:<br>
> <br>
> lldb::SBAddress<br>
> ResolveLoadAddress (lldb::addr_t vm_addr);<br>
> - <br>
> +<br>
> lldb::SBAddress<br>
> ResolvePastLoadAddress (uint32_t stop_id, lldb::addr_t vm_addr);<br>
> <br>
> SBSymbolContext<br>
> - ResolveSymbolContextForAddress (const SBAddress& addr, <br>
> + ResolveSymbolContextForAddress (const SBAddress& addr,<br>
> uint32_t resolve_scope);<br>
> <br>
> %feature("docstring", "<br>
> //----------------------------<wbr>------------------------------<wbr>--------<br>
> - /// Read target memory. If a target process is running then memory <br>
> + /// Read target memory. If a target process is running then memory<br>
> /// is read from here. Otherwise the memory is read from the object<br>
> /// files. For a target whose bytes are sized as a multiple of host<br>
> /// bytes, the data read back will preserve the target's byte order.<br>
> ///<br>
> /// @param[in] addr<br>
> - /// A target address to read from. <br>
> + /// A target address to read from.<br>
> ///<br>
> /// @param[out] buf<br>
> - /// The buffer to read memory into. <br>
> + /// The buffer to read memory into.<br>
> ///<br>
> /// @param[in] size<br>
> /// The maximum number of host bytes to read in the buffer passed<br>
> @@ -589,7 +595,7 @@ public:<br>
> BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line, lldb::addr_t offset);<br>
> <br>
> lldb::SBBreakpoint<br>
> - BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line, <br>
> + BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line,<br>
> lldb::addr_t offset, SBFileSpecList &module_list);<br>
> <br>
> lldb::SBBreakpoint<br>
> @@ -598,14 +604,14 @@ public:<br>
> lldb::SBBreakpoint<br>
> BreakpointCreateByName (const char *symbol_name,<br>
> uint32_t func_name_type, // Logical OR one or more FunctionNameType enum bits<br>
> - const SBFileSpecList &module_list, <br>
> + const SBFileSpecList &module_list,<br>
> const SBFileSpecList &comp_unit_list);<br>
> <br>
> lldb::SBBreakpoint<br>
> BreakpointCreateByName (const char *symbol_name,<br>
> uint32_t func_name_type, // Logical OR one or more FunctionNameType enum bits<br>
> lldb::LanguageType symbol_language,<br>
> - const SBFileSpecList &module_list, <br>
> + const SBFileSpecList &module_list,<br>
> const SBFileSpecList &comp_unit_list);<br>
> <br>
> %typemap(in) (const char **symbol_name, uint32_t num_names) {<br>
> @@ -670,7 +676,7 @@ public:<br>
> lldb::SBBreakpoint<br>
> BreakpointCreateByRegex (const char *symbol_name_regex,<br>
> lldb::LanguageType symbol_language,<br>
> - const SBFileSpecList &module_list, <br>
> + const SBFileSpecList &module_list,<br>
> const SBFileSpecList &comp_unit_list);<br>
> <br>
> lldb::SBBreakpoint<br>
> @@ -708,7 +714,7 @@ public:<br>
> lldb::SBBreakpoint<br>
> FindBreakpointByID (break_id_t break_id);<br>
> <br>
> - <br>
> +<br>
> bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list);<br>
> <br>
> void DeleteBreakpointName(const char *name);<br>
> @@ -726,12 +732,12 @@ public:<br>
> <br>
> %feature("docstring", "<br>
> //----------------------------<wbr>------------------------------<wbr>--------<br>
> - /// Read breakpoints from source_file and return the newly created <br>
> + /// Read breakpoints from source_file and return the newly created<br>
> /// breakpoints in bkpt_list.<br>
> ///<br>
> /// @param[in] source_file<br>
> /// The file from which to read the breakpoints<br>
> - /// <br>
> + ///<br>
> /// @param[out] bkpt_list<br>
> /// A list of the newly created breakpoints.<br>
> ///<br>
> @@ -740,12 +746,12 @@ public:<br>
> //----------------------------<wbr>------------------------------<wbr>--------<br>
> ") BreakpointsCreateFromFile;<br>
> lldb::SBError<br>
> - BreakpointsCreateFromFile(<wbr>SBFileSpec &source_file, <br>
> + BreakpointsCreateFromFile(<wbr>SBFileSpec &source_file,<br>
> SBBreakpointList &bkpt_list);<br>
> <br>
> %feature("docstring", "<br>
> //----------------------------<wbr>------------------------------<wbr>--------<br>
> - /// Read breakpoints from source_file and return the newly created <br>
> + /// Read breakpoints from source_file and return the newly created<br>
> /// breakpoints in bkpt_list.<br>
> ///<br>
> /// @param[in] source_file<br>
> @@ -754,7 +760,7 @@ public:<br>
> /// @param[in] matching_names<br>
> /// Only read in breakpoints whose names match one of the names in this<br>
> /// list.<br>
> - /// <br>
> + ///<br>
> /// @param[out] bkpt_list<br>
> /// A list of the newly created breakpoints.<br>
> ///<br>
> @@ -779,7 +785,7 @@ public:<br>
> ") BreakpointsCreateFromFile;<br>
> lldb::SBError<br>
> BreakpointsWriteToFile(<wbr>SBFileSpec &dest_file);<br>
> - <br>
> +<br>
> %feature("docstring", "<br>
> //----------------------------<wbr>------------------------------<wbr>--------<br>
> /// Write breakpoints listed in bkpt_list to dest_file.<br>
> @@ -800,42 +806,42 @@ public:<br>
> //----------------------------<wbr>------------------------------<wbr>--------<br>
> ") BreakpointsCreateFromFile;<br>
> lldb::SBError<br>
> - BreakpointsWriteToFile(<wbr>SBFileSpec &dest_file, <br>
> + BreakpointsWriteToFile(<wbr>SBFileSpec &dest_file,<br>
> SBBreakpointList &bkpt_list,<br>
> bool append = false);<br>
> <br>
> uint32_t<br>
> GetNumWatchpoints () const;<br>
> - <br>
> +<br>
> lldb::SBWatchpoint<br>
> GetWatchpointAtIndex (uint32_t idx) const;<br>
> - <br>
> +<br>
> bool<br>
> DeleteWatchpoint (lldb::watch_id_t watch_id);<br>
> - <br>
> +<br>
> lldb::SBWatchpoint<br>
> FindWatchpointByID (lldb::watch_id_t watch_id);<br>
> - <br>
> +<br>
> bool<br>
> EnableAllWatchpoints ();<br>
> - <br>
> +<br>
> bool<br>
> DisableAllWatchpoints ();<br>
> - <br>
> +<br>
> bool<br>
> DeleteAllWatchpoints ();<br>
> <br>
> lldb::SBWatchpoint<br>
> - WatchAddress (lldb::addr_t addr, <br>
> - size_t size, <br>
> - bool read, <br>
> + WatchAddress (lldb::addr_t addr,<br>
> + size_t size,<br>
> + bool read,<br>
> bool write,<br>
> SBError &error);<br>
> - <br>
> +<br>
> <br>
> lldb::SBBroadcaster<br>
> GetBroadcaster () const;<br>
> - <br>
> +<br>
> %feature("docstring", "<br>
> //----------------------------<wbr>------------------------------<wbr>--------<br>
> /// Create an SBValue with the given name by treating the memory starting at addr as an entity of type.<br>
> @@ -859,20 +865,20 @@ public:<br>
> <br>
> lldb::SBValue<br>
> CreateValueFromData (const char *name, lldb::SBData data, lldb::SBType type);<br>
> - <br>
> +<br>
> lldb::SBValue<br>
> CreateValueFromExpression (const char *name, const char* expr);<br>
> - <br>
> +<br>
> %feature("docstring", "<br>
> Disassemble a specified number of instructions starting at an address.<br>
> Parameters:<br>
> base_addr -- the address to start disassembly from<br>
> count -- the number of instructions to disassemble<br>
> flavor_string -- may be 'intel' or 'att' on x86 targets to specify that style of disassembly<br>
> - Returns an SBInstructionList.") <br>
> + Returns an SBInstructionList.")<br>
> ReadInstructions;<br>
> lldb::SBInstructionList<br>
> - ReadInstructions (lldb::SBAddress base_addr, uint32_t count); <br>
> + ReadInstructions (lldb::SBAddress base_addr, uint32_t count);<br>
> <br>
> lldb::SBInstructionList<br>
> ReadInstructions (lldb::SBAddress base_addr, uint32_t count, const char *flavor_string);<br>
> @@ -883,7 +889,7 @@ public:<br>
> base_addr -- used for symbolicating the offsets in the byte stream when disassembling<br>
> buf -- bytes to be disassembled<br>
> size -- (C++) size of the buffer<br>
> - Returns an SBInstructionList.") <br>
> + Returns an SBInstructionList.")<br>
> GetInstructions;<br>
> lldb::SBInstructionList<br>
> GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);<br>
> @@ -895,17 +901,17 @@ public:<br>
> flavor -- may be 'intel' or 'att' on x86 targets to specify that style of disassembly<br>
> buf -- bytes to be disassembled<br>
> size -- (C++) size of the buffer<br>
> - Returns an SBInstructionList.") <br>
> + Returns an SBInstructionList.")<br>
> GetInstructionsWithFlavor;<br>
> lldb::SBInstructionList<br>
> GetInstructionsWithFlavor (lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size);<br>
> - <br>
> +<br>
> lldb::SBSymbolContextList<br>
> FindSymbols (const char *name, lldb::SymbolType type = eSymbolTypeAny);<br>
> <br>
> bool<br>
> GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);<br>
> - <br>
> +<br>
> lldb::addr_t<br>
> GetStackRedZoneSize();<br>
> <br>
> @@ -934,12 +940,12 @@ public:<br>
> '''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.'''<br>
> def __init__(self, sbtarget):<br>
> self.sbtarget = sbtarget<br>
> - <br>
> +<br>
> def __len__(self):<br>
> if self.sbtarget:<br>
> return int(self.sbtarget.<wbr>GetNumModules())<br>
> return 0<br>
> - <br>
> +<br>
> def __getitem__(self, key):<br>
> num_modules = self.sbtarget.GetNumModules()<br>
> if type(key) is int:<br>
> @@ -982,11 +988,11 @@ public:<br>
> else:<br>
> print("error: unsupported item type: %s" % type(key))<br>
> return None<br>
> - <br>
> +<br>
> def get_modules_access_object(<wbr>self):<br>
> '''An accessor function that returns a modules_access() object which allows lazy module access from a lldb.SBTarget object.'''<br>
> return self.modules_access (self)<br>
> - <br>
> +<br>
> def get_modules_array(self):<br>
> '''An accessor function that returns a list() that contains all modules in a lldb.SBTarget object.'''<br>
> modules = []<br>
> @@ -1017,13 +1023,13 @@ public:<br>
> <br>
> __swig_getmethods__["<wbr>broadcaster"] = GetBroadcaster<br>
> if _newclass: broadcaster = property(GetBroadcaster, None, doc='''A read only property that an lldb object that represents the broadcaster (lldb.SBBroadcaster) for this target.''')<br>
> - <br>
> +<br>
> __swig_getmethods__["byte_<wbr>order"] = GetByteOrder<br>
> if _newclass: byte_order = property(GetByteOrder, None, doc='''A read only property that returns an lldb enumeration value (lldb.eByteOrderLittle, lldb.eByteOrderBig, lldb.eByteOrderInvalid) that represents the byte order for this target.''')<br>
> - <br>
> +<br>
> __swig_getmethods__["addr_<wbr>size"] = GetAddressByteSize<br>
> if _newclass: addr_size = property(GetAddressByteSize, None, doc='''A read only property that returns the size in bytes of an address for this target.''')<br>
> - <br>
> +<br>
> __swig_getmethods__["triple"] = GetTriple<br>
> if _newclass: triple = property(GetTriple, None, doc='''A read only property that returns the target triple (arch-vendor-os) for this target as a string.''')<br>
> <br>
> <br>
> Modified: lldb/trunk/source/API/<wbr>SBTarget.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=334439&r1=334438&r2=334439&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lldb/trunk/source/API/<wbr>SBTarget.cpp?rev=334439&r1=<wbr>334438&r2=334439&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- lldb/trunk/source/API/<wbr>SBTarget.cpp (original)<br>
> +++ lldb/trunk/source/API/<wbr>SBTarget.cpp Mon Jun 11 14:19:26 2018<br>
> @@ -203,6 +203,11 @@ SBStructuredData SBTarget::GetStatistics<br>
> }<br>
> <br>
> SBProcess SBTarget::LoadCore(const char *core_file) {<br>
> + lldb::SBError error; // Ignored<br>
> + return LoadCore(core_file, error);<br>
> +}<br>
> +<br>
> +SBProcess SBTarget::LoadCore(const char *core_file, lldb::SBError &error) {<br>
> SBProcess sb_process;<br>
> TargetSP target_sp(GetSP());<br>
> if (target_sp) {<br>
> @@ -210,9 +215,14 @@ SBProcess SBTarget::LoadCore(const char<br>
> ProcessSP process_sp(target_sp-><wbr>CreateProcess(<br>
> target_sp->GetDebugger().<wbr>GetListener(), "", &filespec));<br>
> if (process_sp) {<br>
> - process_sp->LoadCore();<br>
> - sb_process.SetSP(process_sp);<br>
> + error.SetError(process_sp-><wbr>LoadCore());<br>
> + if (error.Success())<br>
> + sb_process.SetSP(process_sp);<br>
> + } else {<br>
> + error.SetErrorString("Failed to create the process");<br>
> }<br>
> + } else {<br>
> + error.SetErrorString("SBTarget is invalid");<br>
> }<br>
> return sb_process;<br>
> }<br>
> <br>
> <br>
> ______________________________<wbr>_________________<br>
> lldb-commits mailing list<br>
> <a href="mailto:lldb-commits@lists.llvm.org">lldb-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/lldb-commits</a><br>
<br>
</div></div></blockquote></div><br></div>