[Lldb-commits] [PATCH] D32149: Correct handling NetBSD core(5) files with threads

Kamil Rytarowski via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 20 05:47:33 PDT 2017


krytarowski added inline comments.


================
Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:1374
+    else if ((note.n_name == LLDB_NT_OWNER_NETBSDCORE) &&
+             (note.n_type == LLDB_NT_NETBSD_NT_PROCINFO)) {
       // Set the elf OS version to NetBSD.  Also clear the vendor.
----------------
kettenis wrote:
> krytarowski wrote:
> > kettenis wrote:
> > > By making this change you risk losing recognition of "normal" NetBSD ELF files, i.e. executables and shared libraries.
> > Hmm, do you mean these notes:
> > 
> > ```
> > $ readelf -n /bin/cat                                                                                                                                 
> > 
> > Displaying notes found at file offset 0x00000214 with length 0x00000018:
> >   Owner                 Data size	Description
> >   NetBSD		0x00000004	IDENT 799005900 (7.99.59)
> > 
> > Displaying notes found at file offset 0x0000022c with length 0x00000014:
> >   Owner                 Data size	Description
> >   NetBSD		0x00000004	PaX <>
> > ```
> In particular the first one of these.  On OpenBSD I just have a generic check on the name which catches both these and the core file notes.  But on NetBSD those use different names.
I will test it and add switch to support both types of ELF files: core(5) and executables.


================
Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:563
+
+/// Generic (Linux, ...) specific Thread context from PT_NOTE segment
+/// 1) A Thread Context in a core file usually described by 3 NOTE entries.
----------------
kettenis wrote:
> krytarowski wrote:
> > kettenis wrote:
> > > A bit strange to call something both generic and specific...
> > > 
> > > I think some of these note types originated on SVR4/Solaris, but I'm not sure how much Linux deviated from that design through the years.
> > Can we call it: Type1 core (as of now: NetBSD) and Type2 core (Linux, Android, FreeBSD, OpenBSD)?
> > 
> > I don't care which would be 1 and which 2.
> I'd just drop word "specific" from the comment. And OpenBSD will obviously be handled in a similar way as NetBSD in the near future.
Assuming that NetBSD and OpenBSD will share the same function - we can go pickup appropriate name now.

As far as I can tell FreeBSD shares similar concept to Linux.

A thread specific data is defined by multiplication of the following notes:

```
  FreeBSD       0x000000e0      NT_PRSTATUS (prstatus structure)
  FreeBSD       0x00000200      NT_FPREGSET (floating point registers)
  FreeBSD       0x00000018      NT_THRMISC (thrmisc structure)
```


Repository:
  rL LLVM

https://reviews.llvm.org/D32149





More information about the lldb-commits mailing list