<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64855>64855</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Python LLDB API: Process execution stuck on __sync_add_and_fetch system call
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          aadityasinha10
      </td>
    </tr>
</table>

<pre>
    I have written a python LLDB API code in which I am attaching LLDB debugger to a remote Android HAL process.

I have created a list of breakpoints by parsing all the function names in one of the folders of the source code and am adding each function name as `SBTarget.BreakpointCreateByName(breakpoint)`. In the api code, whenever a breakpoint is hit, I am doing some processing using the function stack and then calling `SBProcess.Continue()`. 

This is working fine for most of the folders in the source code, but for one particular folder, a particular breakpoint is being "hit" in a loop or rather it seems like the process execution gets stuck at that function call. This behavior is similar to the behavior I mentioned in a previous issue I had raised: [Issue 63923](https://github.com/llvm/llvm-project/issues/63923).

I observed two things:

1.) I looked at the contents of that function and its body is just `return (_sync_add_and_fetch(var,0));`. This function is apparently being "inlined" as well, as observed from listing the breakpoints set via the lldb command line tool in Ubuntu.
2.) This function is not a part of the list of function names that I generated from parsing the cpp files in that folder, and nor is it being listed as a function in one of the breakpoint locations after I've added all the breakpoints in the python lldb api code, but somehow, it is still being treated as a breakpoint.

```
for i in range(self.target.GetNumBreakpoints()):
            breakpoint = self.target.GetBreakpointAtIndex(i)
            numLocations = breakpoint.GetNumLocations()
            for l_i in range(numLocations):
                location = breakpoint.GetLocationAtIndex(l_i)
                function = location.GetAddress().GetFunction().GetName()
                if (function is not None and "Atomic" in function):
 print("Function",function,"found.")
```
For example, I thought the above code should print the name of that function, but it didn't.

What could be happening here and how should I deal with it? Any help would be greatly appreciated.
Thank you.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVlFv6jgT_TXmZfSh4BQKDzz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