Re: [PATCH v2 3/6] Display per-thread information for threads in FreeBSD cores.

John Baldwin
2016-01-18T17:06:09Z

On Monday, January 18, 2016 12:27:21 PM Pedro Alves wrote:
> On 01/15/2016 08:13 PM, John Baldwin wrote:
> > On Thursday, January 14, 2016 03:03:50 PM Pedro Alves wrote:
> >> Is this ".thrmisc" section documented somewhere? Could you add a
> >> small comment on what this entry you're skipping means?
> >
> > It is not documented aside from the code unfortunately. :( If I had my
> > way we would be dumping the full ptrace_lwpinfo structure that contains
> > per-LWP info used by the 'nat' target instead (it has other potentially
> > useful information such as the siginfo_t for each thread). At the moment
> > I don't generate a NT_THRMISC note in 'gcore' because 'struct thrmisc' is
> > currently only present in FreeBSD's headers.
>
> I think just having a comment mentioning that this note contains
> the "struct thrmisc" structure, which contains the thread name, would
> be helpful.

Ok.

> But, if this is about the thread name, is there a reason you're hacking it
> through fbsd_core_pid_to_str, rather than hooking this up
> through "thread name" ?

Hmm, would this work for cross-debugging a core file? fbsd_thread_name is
currently only defined for native debugging, whereas core_pid_to_str is a
gdbarch method on the ABI so it can be used to extract thread names from
non-native cores.

Alternatively, would it be best if the core target defined a to_thread_name
method that invoked a new gdbarch method (gdbarch_core_thread_name or the
like) to fetch the thread name?

--
John Baldwin