public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* procmon doesn't capture cygwin's process arguments
@ 2020-11-01 17:59 Oleksandr Gavenko
  2020-11-01 21:41 ` Brian Inglis
  2020-11-02  6:36 ` Andrey Repin
  0 siblings, 2 replies; 5+ messages in thread
From: Oleksandr Gavenko @ 2020-11-01 17:59 UTC (permalink / raw)
  To: cygwin; +Cc: Oleksandr Gavenko

I tried to find out what processes emacs-w32 is starting for my custom
TRAMP method.

"strace -f emacs-w32" fails.

I expected to succeed with procmon & its filter " Command/ Process Start".

Unfortunately procmon [1] doesn't report "argv" if a Cygwin executable is
started from a Cygwin executable. If I run a Cygwin app from the Windows
environment it captures positional arguments.

Is there some option to make positional arguments visible to procmon?

I could find it in:

* https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
* https://cygwin.com/cygwin-ug-net/setup-env.html

Please keep my email in CC...

[1] https://docs.microsoft.com/en-us/sysinternals/downloads/procmon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: procmon doesn't capture cygwin's process arguments
  2020-11-01 17:59 procmon doesn't capture cygwin's process arguments Oleksandr Gavenko
@ 2020-11-01 21:41 ` Brian Inglis
  2020-11-01 21:48   ` Brian Inglis
  2020-11-02  6:36 ` Andrey Repin
  1 sibling, 1 reply; 5+ messages in thread
From: Brian Inglis @ 2020-11-01 21:41 UTC (permalink / raw)
  To: cygwin; +Cc: Oleksandr Gavenko

[-- Attachment #1: Type: text/plain, Size: 1266 bytes --]

On 2020-11-01 10:59, Oleksandr Gavenko via Cygwin wrote:
> I tried to find out what processes emacs-w32 is starting for my custom
> TRAMP method.
> 
> "strace -f emacs-w32" fails.
> 
> I expected to succeed with procmon & its filter " Command/ Process Start".
> 
> Unfortunately procmon [1] doesn't report "argv" if a Cygwin executable is
> started from a Cygwin executable. If I run a Cygwin app from the Windows
> environment it captures positional arguments.
> 
> Is there some option to make positional arguments visible to procmon?
> 
> I could find it in:
> 
> * https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
> * https://cygwin.com/cygwin-ug-net/setup-env.html
> 
> Please keep my email in CC...
> 
> [1] https://docs.microsoft.com/en-us/sysinternals/downloads/procmon

Package procps-ng /usr/bin/procps, and /proc/*/cmdline (null terminated args):

$ procps -aeflw

Suggest:

$ alias cyg-proc=/usr/bin/proc
$ alias proc=/usr/bin/procps

$ head /proc/*/cmdline | cat -A; echo

see attached logs for output.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

[-- Attachment #2: cmdline.log --]
[-- Type: text/plain, Size: 2534 bytes --]

$ head /proc/*/cmdline  | cat -A; echo
==> /proc/17834/cmdline <==$
/bin/sh^@/usr/bin/startxwin^@$
==> /proc/17934/cmdline <==$
xinit^@/etc/X11/xinit/startxwinrc^@--^@/usr/bin/XWin^@:0^@-multiwindow^@-auth^@$HOME/.serverauth.17834^@$
==> /proc/17935/cmdline <==$
/usr/bin/XWin^@:0^@-multiwindow^@-auth^@$HOME/.serverauth.17834^@$
==> /proc/17938/cmdline <==$
/usr/bin/xwin-xdg-menu^@$
==> /proc/17951/cmdline <==$
dbus-launch^@--sh-syntax^@--exit-with-session^@$
==> /proc/17952/cmdline <==$
/usr/bin/dbus-daemon^@--fork^@--print-pid^@5^@--print-address^@7^@--session^@$
==> /proc/17956/cmdline <==$
/usr/bin/gnome-keyring-daemon^@--start^@--components=pkcs11^@$
==> /proc/17964/cmdline <==$
/usr/bin/fbxkb^@$
==> /proc/17966/cmdline <==$
/usr/libexec/gam_server^@$
==> /proc/32326/cmdline <==$
ssh-agent^@$
==> /proc/34859/cmdline <==$
pcmanfm^@$
==> /proc/349/cmdline <==$
/usr/bin/mintty^@-s^@120x60^@-p^@210,120^@-^@$
==> /proc/350/cmdline <==$
-bash^@$
==> /proc/374/cmdline <==$
/usr/bin/cygrunsrv$
==> /proc/375/cmdline <==$
/usr/bin/cygrunsrv$
==> /proc/376/cmdline <==$
/usr/sbin/cygserver$
==> /proc/377/cmdline <==$
/usr/bin/cygrunsrv$
==> /proc/378/cmdline <==$
/usr/sbin/cron$
==> /proc/379/cmdline <==$
/usr/sbin/syslog-ng$
==> /proc/41273/cmdline <==$
/usr/bin/xman^@-pagesize^@600x800+1300+200^@$
==> /proc/42875/cmdline <==$
head^@/proc/17834/cmdline^@/proc/17934/cmdline^@/proc/17935/cmdline^@/proc/17938/cmdline^@/proc/17951/cmdline^@/proc/17952/cmdline^@/proc/17956/cmdline^@/proc/17964/cmdline^@/proc/17966/cmdline^@/proc/32326/cmdline^@/proc/34859/cmdline^@/proc/349/cmdline^@/proc/350/cmdline^@/proc/374/cmdline^@/proc/375/cmdline^@/proc/376/cmdline^@/proc/377/cmdline^@/proc/378/cmdline^@/proc/379/cmdline^@/proc/41273/cmdline^@/proc/42875/cmdline^@/proc/49760/cmdline^@/proc/49765/cmdline^@/proc/self/cmdline^@
==> /proc/49760/cmdline <==$
dirmngr^@--daemon^@--homedir^@$HOME/.gnupg^@$
==> /proc/49765/cmdline <==$
gpg-agent^@--homedir^@$HOME/.gnupg^@--use-standard-socket^@--daemon^@$
==> /proc/self/cmdline <==$
head^@/proc/17834/cmdline^@/proc/17934/cmdline^@/proc/17935/cmdline^@/proc/17938/cmdline^@/proc/17951/cmdline^@/proc/17952/cmdline^@/proc/17956/cmdline^@/proc/17964/cmdline^@/proc/17966/cmdline^@/proc/32326/cmdline^@/proc/34859/cmdline^@/proc/349/cmdline^@/proc/350/cmdline^@/proc/374/cmdline^@/proc/375/cmdline^@/proc/376/cmdline^@/proc/377/cmdline^@/proc/378/cmdline^@/proc/379/cmdline^@/proc/41273/cmdline^@/proc/42875/cmdline^@/proc/49760/cmdline^@/proc/49765/cmdline^@/proc/self/cmdline^@


[-- Attachment #3: procps.log --]
[-- Type: text/plain, Size: 2290 bytes --]

$ procps -aeflw
F S UID        PID  PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY          TIME CMD
0 S $USER      350   349  0  80   0 -   140 -      Oct24 pty0     00:01:13 -bash
0 S SYSTEM     376   374  0  80   0 -     0 -      Oct13 ?        00:30:46 /usr/sbin/cygserver
0 S $USER    41273   350  0  80   0 -   231 -      Oct31 pty0     00:00:03 /usr/bin/xman -pagesize 600x800+1300+200
0 S $USER    49765     1  0  80   0 -    95 -      Oct26 ?        00:01:16 gpg-agent --homedir $HOME/.gnupg --use-standard-socket --daemon
0 S $USER    49760     1  0  80   0 -   349 -      Oct26 ?        00:00:11 dirmngr --daemon --homedir $HOME/.gnupg
0 S SYSTEM     379   377  0  80   0 -     0 -      Oct13 ?        00:00:46 /usr/sbin/syslog-ng
0 S $USER    32326     1  0  80   0 -    84 -      Oct18 ?        00:00:00 ssh-agent
0 S $USER    17938 17934  0  80   0 -   201 -      Oct13 ?        00:03:56 /usr/bin/xwin-xdg-menu
0 S $USER    34859 17938  0  80   0 -   252 -      08:39 ?        00:00:45 pcmanfm
0 S $USER    17966     1  1  80   0 -   217 -      Oct13 ?        08:46:56 /usr/libexec/gam_server
0 S $USER    17951     1  0  80   0 -    84 -      Oct13 ?        00:00:00 dbus-launch --sh-syntax --exit-with-session
0 S $USER    17935 17934  0  80   0 -  2112 -      Oct13 cons0    00:57:53 /usr/bin/XWin :0 -multiwindow -auth $HOME/.serverauth.17834
0 S $USER    17956     1  0  80   0 -   128 -      Oct13 ?        00:01:22 /usr/bin/gnome-keyring-daemon --start --components=pkcs11
0 S $USER      349     1  0  80   0 -   288 -      Oct24 ?        01:26:40 /usr/bin/mintty -s 120x60 -p 210,120 -
0 R $USER    42895   350  0  80   0 -    98 -      14:34 pty0     00:00:00 procps -aeflw
0 S $USER    17952     1  0  80   0 -    89 -      Oct13 ?        00:00:03 /usr/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
0 S $USER    17964 17938  0  80   0 -   124 -      Oct13 ?        00:00:47 /usr/bin/fbxkb
0 S $USER    17934 17834  0  80   0 -    84 -      Oct13 cons0    00:00:00 xinit /etc/X11/xinit/startxwinrc -- /usr/bin/XWin :0 -multiwindow -auth $HOME/.serverauth.17834
0 S SYSTEM     378   375  0  80   0 -     0 -      Oct13 ?        00:00:12 /usr/sbin/cron
0 S $USER    17834     1  0  80   0 -    80 -      Oct13 cons0    00:00:00 /bin/sh /usr/bin/startxwin


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: procmon doesn't capture cygwin's process arguments
  2020-11-01 21:41 ` Brian Inglis
@ 2020-11-01 21:48   ` Brian Inglis
  0 siblings, 0 replies; 5+ messages in thread
From: Brian Inglis @ 2020-11-01 21:48 UTC (permalink / raw)
  To: cygwin; +Cc: Oleksandr Gavenko

On 2020-11-01 14:41, Brian Inglis wrote:
> On 2020-11-01 10:59, Oleksandr Gavenko via Cygwin wrote:
>> I tried to find out what processes emacs-w32 is starting for my custom
>> TRAMP method.
>>
>> "strace -f emacs-w32" fails.
>>
>> I expected to succeed with procmon & its filter " Command/ Process Start".
>>
>> Unfortunately procmon [1] doesn't report "argv" if a Cygwin executable is
>> started from a Cygwin executable. If I run a Cygwin app from the Windows
>> environment it captures positional arguments.
>>
>> Is there some option to make positional arguments visible to procmon?
>>
>> I could find it in:
>>
>> * https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
>> * https://cygwin.com/cygwin-ug-net/setup-env.html
>>
>> Please keep my email in CC...
>>
>> [1] https://docs.microsoft.com/en-us/sysinternals/downloads/procmon
> 
> Package procps-ng /usr/bin/procps, and /proc/*/cmdline (null terminated args):
> 
> $ procps -aeflw
> 
> Suggest:
> 
> $ alias cyg-proc=/usr/bin/proc
> $ alias proc=/usr/bin/procps

Sorry - brain fart:

$ alias cyg-ps=/usr/bin/ps
$ [ -x /usr/bin/procps ] && alias ps=/usr/bin/procps

> $ head /proc/*/cmdline | cat -A; echo
> 
> see attached logs for output.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: procmon doesn't capture cygwin's process arguments
  2020-11-01 17:59 procmon doesn't capture cygwin's process arguments Oleksandr Gavenko
  2020-11-01 21:41 ` Brian Inglis
@ 2020-11-02  6:36 ` Andrey Repin
  2020-11-02  9:04   ` Oleksandr Gavenko
  1 sibling, 1 reply; 5+ messages in thread
From: Andrey Repin @ 2020-11-02  6:36 UTC (permalink / raw)
  To: Oleksandr Gavenko, cygwin

Greetings, Oleksandr Gavenko!

> I tried to find out what processes emacs-w32 is starting for my custom
> TRAMP method.

> "strace -f emacs-w32" fails.

> I expected to succeed with procmon & its filter " Command/ Process Start".

> Unfortunately procmon [1] doesn't report "argv" if a Cygwin executable is
> started from a Cygwin executable. If I run a Cygwin app from the Windows
> environment it captures positional arguments.

> Is there some option to make positional arguments visible to procmon?

> I could find it in:

> * https://cygwin.com/cygwin-ug-net/using-cygwinenv.html

Yes, it's in CYGWIN=wincmdln
But it's not necessarily accurate.
See the documentation for details.

> * https://cygwin.com/cygwin-ug-net/setup-env.html

> Please keep my email in CC...

> [1] https://docs.microsoft.com/en-us/sysinternals/downloads/procmon


-- 
With best regards,
Andrey Repin
Monday, November 2, 2020 9:35:15

Sorry for my terrible english...


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: procmon doesn't capture cygwin's process arguments
  2020-11-02  6:36 ` Andrey Repin
@ 2020-11-02  9:04   ` Oleksandr Gavenko
  0 siblings, 0 replies; 5+ messages in thread
From: Oleksandr Gavenko @ 2020-11-02  9:04 UTC (permalink / raw)
  To: cygwin

Andrey Repin wrote:
> > * https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
> Yes, it's in CYGWIN=wincmdln

Thx. So I was tired enough not to spot that option even when there is
a keyword "argv" on the page ((

> But it's not necessarily accurate.
> See the documentation for details.

Docs said:

(no)wincmdln - if set, the windows complete command line (truncated to ~32K)
will be passed on any processes that it creates in addition to the
normal UNIX argv list.
Defaults to not set.

So the presentation is not accurate if the length exceeds 32K. NP ))

At least I am not blind at what happens with processes. Tested, it works:

CYGWIN=wincmdln emacs-w32 -Q

The first process doesn't report its argv, but all children do.

The solution of Brian Inglis (of using "ps" or "/proc/*/cmdline") is
not viable in situations when
processes start and die quickly.

I need some tracer, "strace" crashed Emacs & procmon has nice UI.

Tnx!


On Mon, Nov 2, 2020 at 8:50 AM Andrey Repin <anrdaemon@yandex.ru> wrote:
>
> Greetings, Oleksandr Gavenko!
>
> > I tried to find out what processes emacs-w32 is starting for my custom
> > TRAMP method.
>
> > "strace -f emacs-w32" fails.
>
> > I expected to succeed with procmon & its filter " Command/ Process Start".
>
> > Unfortunately procmon [1] doesn't report "argv" if a Cygwin executable is
> > started from a Cygwin executable. If I run a Cygwin app from the Windows
> > environment it captures positional arguments.
>
> > Is there some option to make positional arguments visible to procmon?
>
> > I could find it in:
>
> > * https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
>
> Yes, it's in CYGWIN=wincmdln
> But it's not necessarily accurate.
> See the documentation for details.
>
> > * https://cygwin.com/cygwin-ug-net/setup-env.html
>
> > Please keep my email in CC...
>
> > [1] https://docs.microsoft.com/en-us/sysinternals/downloads/procmon
>
>
> --
> With best regards,
> Andrey Repin
> Monday, November 2, 2020 9:35:15
>
> Sorry for my terrible english...
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-02  9:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-01 17:59 procmon doesn't capture cygwin's process arguments Oleksandr Gavenko
2020-11-01 21:41 ` Brian Inglis
2020-11-01 21:48   ` Brian Inglis
2020-11-02  6:36 ` Andrey Repin
2020-11-02  9:04   ` Oleksandr Gavenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).