DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 53RLwU65537393 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 53RLwU65537393 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=g0edLJFw X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E807D3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1745791108; bh=VlDYMEsc1e7o7yMCV2NV8QiRYfABXKYGuZrm5AAX2uw=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=g0edLJFwV/LmipSobvzehaMXrAQrG0ZImfdPbL5yFTQVsYGyiRX6N0Th0iCFJIZRf qX0zw+Q854pJkPjd402e5nkeWsLfxj/wl2DMO6Dzinq9KYnqUeaqf62oXCKVyVFyRc QFYaS+toBJJ6slDToR3QfinjEQdENt4eF/Q26DUo= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2A19F3858D1E ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2A19F3858D1E ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1745791085; cv=none; b=MdhCXg7wI7wQUlxJYwf+Fg83+bNOgxZhBflHqLnBO5JzHlLhPWY3kmBNquXNT3N3EeAEuAfv+0U1CCsmFS9fwM1hbGcyhPNnSbnPeOa/ZUNHBJ0Z1pLeN5z51dFOmOJmFWjT0qqRAzvQ/92G4ENoBuGXck7oeAO3D+hf783EXsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1745791085; c=relaxed/simple; bh=UIzYxAw/c2AsnqmxTSj7Kx6n62nUKWtNdFLoEpXtM48=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=TtJVsmRy97Jlnph9TwQIkiJOL5YjVzHlnNSxgkSlHngrzY2gVTby5gDCnsQDWCUOLp47NBk38931U29X4IAcYDWzkEzisOdHXhFZ1kLndXlHjnREX9uzHVPRwABMTdU+RzWYKQa84IQNuJg6odVZmOn704ZL8ZkqUNCR7RzxZuM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A19F3858D1E Date: Sun, 27 Apr 2025 14:58:04 -0700 (PDT) X-X-Sender: jeremyd AT resin DOT csoft DOT net To: cygwin AT cygwin DOT com Subject: enumerating loaded modules on Cygwin Message-ID: <6a5d6737-ebba-9d10-7e9f-3aae3ea3989a@jdrake.com> MIME-Version: 1.0 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Jeremy Drake via Cygwin Reply-To: Jeremy Drake Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Cygwin" I was asked an interesting question on a github issue about rust backtraces: is there an API in Cygwin to get a list of loaded modules? I know the info is there in the dlls list, but I don't see an API to get at it. The question was in regards to whether rust should be using toolhelp32 on Cygwin as it does on Windows to get a list of modules, load addresses, and sizes to then use to identify from which module addresses in a backtrace are from. It appears the general non-Windows case uses dl_iterate_phdr to do this, but it also appears that this function is pretty ELF-specific. It feels like most of the data could be filled out from Windows APIs, but I'm not sure it makes sense to. I recommended to them to use cygwin_conv_path(CCP_WIN_W_TO_POSIX, ...) on the szExePath rather than WideCharToMultiByte(CP_UTF8), or to pass the hModule to dlinfo to get the name, or to inspect /proc/self/maps (which the non-Windows path also uses in concert with dl_iterate_phdr). -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple