Hi Martin,
I think /proc/thePid/exe was not used, because it only works for root. We can add new property to return /proc/thePid/exe when available. You can use FileSystem.readlink(“/proc/thePid/exe”)
command as workaround. And readlink returns ENOENT for kernel threads – a good way to distinguish a kernel-thread from a user-thread on Linux.
Regards,
Eugene
From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx]
On Behalf Of Oberhuber, Martin
Sent: Monday, June 01, 2015 5:23 AM
To: TCF Development
Subject: [tcf-dev] SysMonitor: Absolute path of the executable of process ?
Hi tcf experts,
Given a context from SysMonitor service (tcf-agent running on Linux), we want to find out the absolute path of its executable (process image).
From reading the SysMonitor Protocol docs, my expectation was that the “File” Property should return that absolute path:
https://git.eclipse.org/c/tcf/org.eclipse.tcf.git/plain/docs/TCF%20Service%20-%20System%20Monitor.html
But looking at the implementation in the Reference Agent for Linux, only the basename of the Process is filled in (line 1280 here):
https://git.eclipse.org/c/tcf/org.eclipse.tcf.agent.git/tree/agent/tcf/services/sysmon.c
It seems that when tcf-agent runs as root, readlink(“/proc/thePid/exe”) would return the answer that we want.
Would it make sense changing the agent to return this information that way ?
Or is there a better way ?
We really need the absolute path to the process image, such that we can apply proper path mapping for our cross-debugger and find the symbol file on the host.
Thanks,
Martin
--
Martin Oberhuber, SMTS / Product Owner – Development Tools,
Wind River
direct +43.662.457915.85 fax +43.662.457915.6