clayborg added a comment.

In D88387#2318226 <https://reviews.llvm.org/D88387#2318226>, @jasonmolenda 
wrote:

> I was thinking about the UI of this some more today.
>
> I think process save-core should take a --core-style argument with an enum of 
> (currently) 'full' or 'modified-memory'.  Plugin::SaveCore will take a 
> requested_coredump_style and will return an created_coredump_style.  The user 
> can request a modified-memory coredump on linux, but it's not supported so 
> they get a full coredump.  We could have "stack-only" coredumps (this would 
> be an awful lot like a minidump iiuc, and may be duplicative), or 
> "modified-memory-plus-binary-images" (better name tbd) which would copy in 
> the binary images of any executing binaries or whatever.

That seems like a lot of flavors. At the command level I would suggest just 
some arguments. To the SaveCore, it can take a bitfield with all of the options 
the user selected. Options I can think of:

--full: which would specify to save all memory regions
--modified: save any modified data pages that are not thread stacks. I would 
suggest the core file plug-in returns an error if it doesn't support this to 
provide a better user experience. This could imply --stacks or it could be a 
stand alone option.
--stacks: save the thread stacks, very close to minidumps as you mentioned if 
only this is specified
--stack-functions: save memory for the code for all function bodies from all 
stack frames in all threads. This helps with stack tracing if we have no access 
to the system object files
--minimal-heap: save only the allocated memory from heaps. Often times the 
system malloc allocators will grab large chunks of memory and hand out partial 
chunks when malloc is called. On Darwin, we could easily find out the actual 
allocations that are live on the heap and only save 
those?
--crashing-thread-only: only save threads that crashed. Cuts down on memory 
size for stacks, and stack functions.

We could then make a bitfield of options:

  enum uint32_t CoreFileOptions {
    eFull = (1u << 0),
    eModifiedPages = (1u << 1),
    eThreadStacks = (1u << 2),
    eThreadFunctions = (1u << 3),
    eMinimalHead = (1u << 4),
    eCrashingThreadOnly = (1u << 5)
  };

And then pass a "uint32_t flags" to the save core instead of the bool.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88387/new/

https://reviews.llvm.org/D88387

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to