Hi,
[email protected] (2018-07-26 at 0008.50 -0400):
> Sorry, I'm not sure I understand the problem.  The '-o' option works as
> expected here:
> 
>   $ bash /usr/bin/gcore 21153
>   0x00007f11fc3d0404 in __GI___nanosleep (requested_time=0x7ffc3cb70240, 
> remaining=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:28
>   28  ../sysdeps/unix/sysv/linux/nanosleep.c: No such file or directory.
>   Saved corefile core.21153
> 
>   $ bash /usr/bin/gcore -o blabla 21258
>   0x00007f3531233404 in __GI___nanosleep (requested_time=0x7fff80925a40, 
> remaining=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:28
>   28  ../sysdeps/unix/sysv/linux/nanosleep.c: No such file or directory.
>   Saved corefile blabla.21258
> 
>   $ bash /usr/bin/gcore -o blabla 21549 21550
>   0x00007fc267908404 in __GI___nanosleep (requested_time=0x7ffc76bc1c80, 
> remaining=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:28
>   28  ../sysdeps/unix/sysv/linux/nanosleep.c: No such file or directory.
>   Saved corefile blabla.21549
>   0x00007fab24ce5404 in __GI___nanosleep (requested_time=0x7ffc2d80a380, 
> remaining=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:28
>   28  ../sysdeps/unix/sysv/linux/nanosleep.c: No such file or directory.
>   Saved corefile blabla.21550

The man page says you can ask for filename blabla, then uses
blabla.21258. That is the problem, it's not a filename, more like a
template, and between getting blabla.21258 or core.21258, no big win,
IMO. If it needs extra handling to end in the file you really wanted,
probably you can rename any of them, or wrap with pushd/popd to change
directory.

Compare also to many other programs, when they talk about a file or
filename, they normally use what is provided, unchanged. wget -i -o -a
and -O, sed -f, etc. wget doesn't force url files to end in .url, or
logging ones in .log, or ... You want to use .txt or no extension? All
work. You can even feed device names or connect to processes if the
shell supports "making files". They are flexible.

Thing talks about filename, I expect filename result, not that it
magically means template. Just as mayority of programs do.

> > While checking what was going on, I found -a is not documented in man
> > page, and script has not comment at all about what it really does
> > (options are found in 10.19 of info docs, it toggles two defaults,
> > Linux only).
> 
> For some reason (probably because of the non-free aspect of it), the
> version of gdb.texinfo present in the salsa GDB repo is not the one
> shipped on upstream GDB 8.1.  The gcore manpage is generated from this
> file, so this is why you're seeing an old version of it.

Indeed, very old, it says 6.8.

> > Suggestions:
> >
> > - change man page and -h output to say "pid[s]".
> 
> This change would be welcome, IMO.

See patches... manpage one is probably moot, if generated from other
source, but could be used as reference.

Other option is simplifying the script, and users do multiple calls,
one per PID. Which I guess it was how it worked before as that is the
man page "tone" (process, not processes, pid, not pids, etc).

> > - support single PID with exact filename (no .pid extension). If you
> >   can get a list of PIDs, you can also probably do the loop, so the
> >   feature isn't so helpful but more importantly it disallows things
> >   like '-o >( gzip - > "path/${PID}.gz" )' (on the fly compression) or
> >   '-o "$T"' (a safe T created by tempfile(1)).
> >
> > - fix man page for -o "write core file to filename if one PID, or
> >   filename.pid if multiple PIDs, instead of default core.pid".
> 
> I don't really understand the two proposals above.

IOW: If you ask for a file to be used, it should be that one when
possible (single PID case), not something else. "Do what I say,
cooperate". And document that.

Cheers,
GSR
 

Reply via email to