llnode icon indicating copy to clipboard operation
llnode copied to clipboard

error message for a node binary to core file mismatch

Open brendangregg opened this issue 8 years ago • 4 comments

Is it possible to detect that there is a version mismatch between node and the core file, and print an error or warning? Here I'm using the wrong version of node with a core file, and it doesn't complain, but it would be helpful if it did.

(lldb) target create "node" --core "core.3397"
Core file '/mnt/core.3397' (x86_64) was loaded.
(lldb) v8 nodeinfo
No process objects found.

brendangregg avatar Jun 19 '17 20:06 brendangregg

I agree it would be nice. I looked into it earlier this year but I couldn't find good, unambiguous eyecatchers. Probably one should be added upstream.

bnoordhuis avatar Jun 20 '17 10:06 bnoordhuis

In an ELF core (linux) you might be able to use the program headers or the NT_FILE note to validate you are using the right executable but you'd probably want to do it inside lldb not llnode.

hhellyer avatar Jun 20 '17 15:06 hhellyer

That wouldn't help if the binary was upgraded in place after the core file was generated, would it? That seems like the most likely scenario you'd want to detect.

As well, older kernels don't emit NT_FILE notes.

bnoordhuis avatar Jun 20 '17 15:06 bnoordhuis

GDB gives two messages when it thinks the core may not match the executable:

warning: exec file is newer than core file. is given if the core is older than the executable.

warning: core file may not match specified executable file. is given when the validation fails. To Linux ELF programs, the only validation made is by executable name (same as suggested by @hhellyer).

This certainly should be a lldb feature, unless we want to print node's version from the core and the executable (not sure if it's possible though).

mmarchini avatar Aug 23 '17 14:08 mmarchini