<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">You need to call SBDebugger::Initialize() before calling SBDebugger::Create().<div class=""><br class=""></div><div class="">Also, please use the <span style="background-color: rgb(255, 255, 255);" class="">SBLaunchInfo</span> method for launching if possible where you create a <span style="background-color: rgb(255, 255, 255);" class="">SBLaunchInfo, then call tgt.Launch() with the instance.</span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class="">Other than that, as Jim said, you need to setup an event loop if you don't use synchronous mode where you wait for events and respond to events. </span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class="">Greg<br class=""></span><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 26, 2019, at 4:58 AM, Jayvee Neumann via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:monospace,monospace">Dear LLDB developers,</div><div class="gmail_default" style="font-family:monospace,monospace"><br class=""></div><div class="gmail_default" style="font-family:monospace,monospace">I am currently stuck while using the C++ API of LLDB. I am unable to correctly launch a process.</div><div class="gmail_default" style="font-family:monospace,monospace">The code I have written looks as follows:</div><div class="gmail_default" style="font-family:monospace,monospace"><br class="">int main(int argc, char *argv[]){<br class=""><div style="margin-left:40px" class=""> LLDBSentry senty;<br class=""> SBDebugger dbg(SBDebugger::Create());<br class=""> ...<br class=""> const char *exeFilePath = "./target";<br class=""> const char *arch = "x86_64";<br class=""> const char *platform = "";<br class=""> const char *dependentLibs = ""; <br class=""> SBError error;<br class=""> SBTarget tgt = dbg.CreateTarget(exeFilePath, arch, platform, dependentLibs, error);<br class=""> ...<br class=""> SBListener listen;<br class=""> SBProcess proc = tgt.Launch(<br class=""></div><div style="margin-left:80px" class=""> listen,<br class=""> nullptr,<br class=""> nullptr,<br class=""> nullptr,<br class=""> "targetout.txt",<br class=""> nullptr,<br class=""> "./",<br class=""> eLaunchFlagExec | eLaunchFlagDebug,<br class=""> false,<br class=""> error<br class=""></div><div class="gmail_default" style="font-family:monospace,monospace;margin-left:40px"> );<br class="">...<br class=""> SBThread thread = proc.GetSelectedThread(); // (1)<br class=""></div></div><div class="gmail_default" style="font-family:monospace,monospace;margin-left:40px">...</div><div class="gmail_default" style="font-family:monospace,monospace">}</div><div class="gmail_default" style="font-family:monospace,monospace"><br class=""></div><div class="gmail_default" style="font-family:monospace,monospace">The complete code (usr.cpp) is added as an attachment to this email.</div><div class="gmail_default" style="font-family:monospace,monospace">Its output is also added as a text file (stdout.txt) to this email.</div><div class="gmail_default" style="font-family:monospace,monospace"><br class=""></div><div class="gmail_default" style="font-family:monospace,monospace">The problem I have is, that thread.IsValid() returns null after line (1). Furthermore, the process says, that its state is eStateStopped, when asked via proc.IsStopped() it answers "false", however.<br class=""></div><div class="gmail_default" style="font-family:monospace,monospace">The debugging target is a simple file that writes a hexadecimal number every 10us to stdout. I can see that the target is running, because targetout.txt is growing in size and its content is valid output from "target".</div><div class="gmail_default" style="font-family:monospace,monospace">Can you tell me what my mistake is?</div><div class="gmail_default" style="font-family:monospace,monospace"><br class=""></div><div class="gmail_default" style="font-family:monospace,monospace">Kind Regards</div><div class="gmail_default" style="font-family:monospace,monospace">Jayvee<br class=""></div><div class="gmail_default" style="font-family:monospace,monospace"><br class=""></div></div>
<span id="cid:f_jxd4t7do1"><usr.cpp></span><span id="cid:f_jxd4t7df0"><stdout.txt></span>_______________________________________________<br class="">lldb-dev mailing list<br class=""><a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev<br class=""></div></blockquote></div><br class=""></div></body></html>