[PATCH 1/5] Cygwin: Make 'ulimit -c' control writing a coredump
Corinna Vinschen
corinna-cygwin@cygwin.com
Mon Jan 15 09:46:36 GMT 2024
On Jan 13 14:20, Jon Turney wrote:
> On 12/01/2024 14:09, Jon Turney wrote:
> > +
> > + PWCHAR cp = dumper_command;
> > + cp = wcpcpy (cp, L"\"");
> > + cp = wcpcpy (cp, dll_dir);
> > + cp = wcpcpy (cp, L"\\dumper.exe");
> > + cp = wcpcpy (cp, L"\" ");
> > + cp = wcpcpy (cp, L"\"");
> > + cp = wcpcpy (cp, global_progname);
>
> I wonder if this should be program_invocation_short_name, so that the
> coredump is created in the cwd, rather than next to the executable.
program_invocation_short_name would be nice, but does it really matter?
Because...
> But then, there's then no way to get similar behaviour if you decide you
> want to use minidumps instead (by setting CYGWIN="error_start=minidumper"),
> as the first argument to dumper/minidump is the full path to the program (to
> match the 'prog procID' style of invoking gdb), but they only use it to add
> an .core/.dmp extension to name the file to write.
>
> I guess that could by fixed by adding an option to the dumpers to strip
> paths, or more control about how the JIT command is formatted.
dumper/minidumper are both called with the current working directory set
to the ... current working directory, right? With the full pathname as
input, and the CWD already set the same as the dumped application, they
can easily generate any target path for the corefile they like.
Given the actual path of the corefile can be generated by the dumpers,
the question is how to specify where to store the corefile. For instance
- no option: CWD
- some option -c/--coredir for anywhere else
Under Linux versions using systemd, corefiles are by default not stored
in the CWD anymore, but to /var/lib/systemd/coredump, so there is a
use case for arbitrary corefile paths.
Corinna
More information about the Cygwin-patches
mailing list