Page MenuHomePhabricator

Fix loading core(5) files from NetBSD 7.99.67

Authored by krytarowski on Apr 7 2017, 12:13 PM.



This change has been authored by Zachary Turner.

It fixes loading into the debugger core(5) files generated
by NetBSD x86_64 v. 7.99.67.

It does not make exporting the core properties from notes
work, it's limited to elimination of crashes of the debugger.
To trigger the crash LLDB needs to be just executed this

lldb -c ./core

Diff Detail


Event Timeline

krytarowski created this revision.Apr 7 2017, 12:13 PM
krytarowski edited the summary of this revision. (Show Details)

Example core(5) file:

Generated with gcore(1), which snapshoted a running top(1) program.

krytarowski edited the summary of this revision. (Show Details)Apr 7 2017, 3:59 PM
krytarowski added a comment.EditedApr 8 2017, 1:46 PM

Hmm still wrong.

Later in this code:

// NetBSD per-thread information is stored in notes named
// "NetBSD-CORE@nnn" so match on the initial part of the string.
m_os = llvm::Triple::NetBSD;
if (note.n_type == NETBSD::NT_PROCINFO) {
  ParseNetBSDProcInfo(*thread_data, note_data);
} else if (note.n_type == NETBSD::NT_AUXV) {
  m_auxv = DataExtractor(note_data);
} else if (arch.GetMachine() == llvm::Triple::x86_64 &&
           note.n_type == NETBSD::NT_AMD64_REGS) {
  thread_data->gpregset = note_data;
} else if (arch.GetMachine() == llvm::Triple::x86_64 &&
           note.n_type == NETBSD::NT_AMD64_FPREGS) {
  thread_data->fpregset = note_data;

arch.GetMachine() evaluates to llvm::Triple::UnknownArch and gpregset and fpregset is never set.

Other BSDs work.

labath requested changes to this revision.Apr 11 2017, 4:15 AM

This makes all sorts of tests fail. Regardless of your platform you should at least be able to reproduce the following failures:

FAIL: test_FPR_SSE (functionalities/postmortem/elf-core/
FAIL: test_image_list_shows_multiple_architectures (functionalities/object-file/
FAIL: test_local_variables_in_minidump (functionalities/postmortem/minidump-new/
ERROR: test_deeper_stack_in_minidump (functionalities/postmortem/minidump-new/
ERROR: test_deeper_stack_in_minidump_with_same_pid_running (functionalities/postmortem/minidump-new/
ERROR: test_two_cores_same_pid (functionalities/postmortem/minidump-new/

Let me know if you have problems reproducing these, and I can then take a look.

This revision now requires changes to proceed.Apr 11 2017, 4:15 AM

I might need some guidance to address the asserts appropriately in finite time.

In general we set osabi to generic unix (value 0), and NetBSD core(5) files are distinguished only (or mostly) with "NetBSD-CORE*" notes.

krytarowski abandoned this revision.Apr 16 2017, 5:30 PM

I will fix the original problem differently. Thanks for help!