jasonmolenda wrote:

> > You could imagine someone making an ELF corefile output capability, for 
> > instance.
> 
> Yes I'd love to be generating the core files eventually. Maybe we can with 
> yaml2obj but I never seriously looked into it. As right now, patching in 
> notes by hand makes for smaller files, but it's not reproducible or self 
> documenting.
> 
> I assume the existing yaml2obj cannot make core files, or you wouldn't be 
> writing this.

I don't think yaml2obj does make corefiles, but I believe this utility serves a 
different purpose.  yaml2obj could if you already have a small corefile 
(they're rarely small) that only contains the bytes needed to reproduce a bug 
that you want to test.  You may need to hand-modify an existing corefile to 
remove unnecessary memory segments, or to change values to elicit some behavior 
you want to test.

The idea with this tool is that you have the memory bytes that are critical to 
show an issue, or register values, and you want to construct a corefile based 
on those bytes. You may not be starting with a real corefile to begin with.  
For that matter, you might construct stack memory values manually to elicit an 
unwinder bug, for instance.  (nb until I find a way for ObjectFileJSON to 
specify unwind rules for functions, this is unlikely to work, unless you copy 
the bytes of the relevant functions into the YAML so lldb can do its 
instruction emulation unwind plan).

Last week I had a bug report of someone seeing an issue with lldb in a firmware 
environment, where it would be difficult for me to set up the environment and 
corefiles were not an option.  I got the register values & 400 bytes of stack 
memory (lit. just "reg read" and "mem read"), and a copy of the relevant binary 
+ dSYM, reformatted it all into YAML and created a Mach-O corefile that was 
able to reproduce the issue on my desktop.  Pretty handy!  Agree this is not 
common, but it was funny it came up only a couple weeks after I wrote the tool.

I think it fills a niche distinct from obj2yaml / yaml2obj, regardless of 
corefile support in that tool.

https://github.com/llvm/llvm-project/pull/153911
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to