From owner-freebsd-hackers@freebsd.org Sat Jan 4 09:07:50 2020 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 596A81D06A1 for ; Sat, 4 Jan 2020 09:07:50 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms-10.1blu.de (ms-10.1blu.de [178.254.4.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47qbX46Ytmz42Fg for ; Sat, 4 Jan 2020 09:07:48 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from [188.174.60.254] (helo=localhost.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from ) id 1infPN-0003Wq-WE for freebsd-hackers@freebsd.org; Sat, 04 Jan 2020 10:07:46 +0100 Received: from localhost.my.domain (localhost [127.0.0.1]) by localhost.unixarea.de (8.15.2/8.14.9) with ESMTPS id 00497iIC003173 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Sat, 4 Jan 2020 10:07:44 +0100 (CET) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.15.2/8.14.9/Submit) id 00497h4f003172 for freebsd-hackers@freebsd.org; Sat, 4 Jan 2020 10:07:43 +0100 (CET) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Sat, 4 Jan 2020 10:07:43 +0100 From: Matthias Apitz To: freebsd-hackers@freebsd.org Subject: getting the name of a C-function in the C-code based on a pointer to the function Message-ID: <20200104090743.GA3017@c720-r342378> Reply-To: Matthias Apitz Mail-Followup-To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="J/dobhs11T7y2rNN" Content-Disposition: inline X-Operating-System: FreeBSD 13.0-CURRENT r342378 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. User-Agent: Mutt/1.11.1 (2018-12-01) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 188.174.60.254 X-Rspamd-Queue-Id: 47qbX46Ytmz42Fg X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of guru@unixarea.de has no SPF policy when checking 178.254.4.101) smtp.mailfrom=guru@unixarea.de X-Spamd-Result: default: False [-3.88 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[guru@unixarea.de]; HAS_XOIP(0.00)[]; HAS_XAW(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; SIGNED_PGP(-2.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[254.60.174.188.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; RCVD_IN_DNSWL_LOW(-0.10)[101.4.254.178.list.dnswl.org : 127.0.5.1]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:42730, ipnet:178.254.0.0/19, country:DE]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; DMARC_NA(0.00)[unixarea.de]; R_SPF_NA(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-1.08)[ip: (-8.03), ipnet: 178.254.0.0/19(1.41), asn: 42730(1.25), country: DE(-0.02)] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2020 09:07:50 -0000 --J/dobhs11T7y2rNN Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello hackers, What I'm locking for is how to get the name of a function, into a string po= inter for logging purpose as printf("function called: %s\n", p); based on a pointer to the function because in our realworld code it looks l= ike this: int fun(*module(), ...) { char *p =3D .... printf("calling module %s\n", p); (*module)(int i); } i.e. the function fun() gets only a pointer to a function to be called (one of around 400 different functions of a shared lib)=20 Any (portable idea)? Thanks matthias --=20 Matthias Apitz, =E2=9C=89 guru@unixarea.de, http://www.unixarea.de/ +49-176= -38902045 Public GnuPG key: http://www.unixarea.de/key.pub "Glaube wenig, hinterfrage alles, denke selbst: Wie man Manipulationen durc= hschaut" "Believe little, scrutinise all, think by your own: How see through manipul= ations" ISBN-10: 386489218X --J/dobhs11T7y2rNN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEXmn7rBYYViyzy/vBR8z35Hb+nREFAl4QVdwACgkQR8z35Hb+ nREjeA//VHh2BUuyGQqaueFkBwab6HreLD0d8zuCv07j9Dsf3R9SKGcKV76+rWcx 5iuR9xdVhqiBttLsPuOBSLZVEo8rcFFsfRjHhZVLAqycdIrP2NVmdJaSVijx0xBp xKa02uVq/wp2ChKY6xKJjNjpGuoSS6l71qPJv6IieRftwPzXdWRVFU8sXqSObUru 5HSx5I9oKJAzXIgwWtSJO1biyrrcJrRg8pPPG64+pqZQ5DdRjrGhxBlHz9UUf1Ek yxlBi9dcC+vpsW/429hZdPdtg4DuGh+kpBZ6ILQJPlaflLHbVSlYvGleA9qwbA7E MMDzmonreeqeab+8dgTG895jzjgdR8iq0gaxcfz7Wf6UKKG1MK6f1kRmx/tdIf5y IFQ7LuTaoCuEiN64S8mSDmKNKmVEgPplios3feVfKIIyD6wDbEVwNQqm5sobza5f TlGOlx/SKug0M4SO6y2P9MTow5ueYkRRjgo3dgSeZg5hczuO0quo8Ef4Lc3hy33s Db4B+C0L6zmVvlendGl0Q6H+TEpUAO8XZjsD9wpDyIWN8f35DN2XSYowgG7rauGM kRmgza++O33qhijfLJZEYGW88nXDTgBuSLfzpvov12HBuUxeo/CBgKY+Gl7TQ/lf +6SzzyqflKvbK8vlN3yvclbkv0fbLgATpvy2pVwcOgRhb7RRQZU= =vTii -----END PGP SIGNATURE----- --J/dobhs11T7y2rNN--