[Lldb-commits] [lldb] [lldb] Add Populate Methods for ELFLinuxPrPsInfo and ELFLinuxPrStatus (PR #104109)

Will Hawkins via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 16 23:19:24 PDT 2024


hawkinsw wrote:

I am _not_ an expert but did a little investigation and wanted to help if I could:

It looks like the problem is that `gettid` is defined (at least on Linux systems) only when the `__USE_GNU` macro is defined. From the `man` page:

```
SYNOPSIS
       #define _GNU_SOURCE
       #include <unistd.h>

       pid_t gettid(void);
```

It seems like we could fix the break in one of two ways:

1. Move the 
```Cmake
if (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
  add_subdirectory(elf-core)
```
into an if that checks exclusively for `Linux`; or
2. Use a `#ifdef _USE_GNU` in the actual test.

Both seem overly aggressive because they would defeat the purpose of the test. 

I did find that there seems to be a platform-independent means of getting the thread id in `packages/Python/lldbsuite/test/make/thread.h` -- we could repurpose that implementation to use in this test rather than calling  `gettid` directly. 

If that is something worth exploring, just let me know! I would be more than glad to help!

https://github.com/llvm/llvm-project/pull/104109


More information about the lldb-commits mailing list