API got SIGCHLD on hitting the breakpoint

Hello, everyone

I am using LLDB API to implement a gui debugger, but if I set a breakpoint using the following code:

// variable i is the line number to set breakpoint at.
SBBreakpoint b = m_target.BreakpointCreateByLocation(m_target.GetExecutable().GetFilename(), i);
qDebug(“Created Breakpoint %s At Line %d.”, qPrintable(QString::number(b.GetNumLocations()).toLocal8Bit()), i);

When I launch the program using m_target.LaunchSimple(NULL, NULL, “/”) and when the target hit the breakpoint, the gui debugger crashes and exits. If I start the gui debugger using lldb I can see the following output:

(lldb) r
Process 14932 launched: ‘/home/szm/Documents/workSpace/qt/build-studio2-LLVM_qt5-Debug/studio2’ (x86_64)
Process 14932 stopped and restarted: thread 1 received signal: SIGCHLD
Created Breakpoint 0 At Line 7. ← this is my program’s output.
Process 14932 stopped and restarted: thread 9 received signal: SIGCHLD
Process 14932 stopped

  • thread #9: tid = 14953, 0x00007f1c5d5fa102 liblldb.soProcessMonitor::ServeOperation(ProcessMonitor::OperationArgs*) + 50, name = 'operation', stop reason = invalid address (fault address: 0x11) frame #0: 0x00007f1c5d5fa102 liblldb.soProcessMonitor::ServeOperation(ProcessMonitor::OperationArgs*) + 50
    liblldb.so`ProcessMonitor::ServeOperation(ProcessMonitor::OperationArgs*) + 50:
    → 0x7f1c5d5fa102: callq 0x10(%rdx)
    0x7f1c5d5fa105: movq %rbp, %rdi
    0x7f1c5d5fa108: callq 0x7f1c5c8c1a80 ; symbol stub for: sem_post
    0x7f1c5d5fa10d: jmp 0x7f1c5d5fa0f0 ; ProcessMonitor::ServeOperation(ProcessMonitor::OperationArgs
    ) + 32
    (lldb)

Seems that the program got SIGCHLD because the “invalid address”, but I have no idea how to fix it. (I’m using ubuntu 14.04 with lldb-3.4-dev from apt-get.)

Thanks,
Song Ziming

Just did an experiment, and I found that the breakpoint I set using SBTarget::BreakpointCreateByLocation does not trigger.

First I set the debugger’s async to be false, then created a breakpoint specifying its location by:

m_target.BreakpointCreateByLocation(target.GetExecutable().GetFilename(), 7);

then I launch the program and after getting eStateExited status, the hit count of that breakint is 0!

Is the way I set the break point wrong? I can create a working breakpoint using SBTarget::BreakpointCreateByName but cannot using SBTarget::BreakpointCreateByLocation, what’s the problem?

Thanks,
Song Ziming

Hi Ziming,

The first thing you want to do is build and install the latest LLDB from llvm.org. If it is still a problem, please file a bug (with trivial repro steps if possible).

Vince

You are setting the breakpoint using the name of the executable. i.e. the command line equivalent of:

(lldb) break set -f a.out -l 7

You want some to pass the name of some source file in the executable.

Jim