From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 16 02:16:33 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D7B1106566B for ; Sun, 16 Oct 2011 02:16:33 +0000 (UTC) (envelope-from kaduk@mit.edu) Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU [18.7.68.34]) by mx1.freebsd.org (Postfix) with ESMTP id E16678FC08 for ; Sun, 16 Oct 2011 02:16:32 +0000 (UTC) X-AuditID: 12074422-b7ff56d00000092f-6e-4e9a3afa9e0d Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP id 10.F9.02351.AFA3A9E4; Sat, 15 Oct 2011 22:01:30 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id p9G21UrB009620; Sat, 15 Oct 2011 22:01:30 -0400 Received: from multics.mit.edu (MULTICS.MIT.EDU [18.187.1.73]) (authenticated bits=56) (User authenticated as kaduk@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p9G21RkV007011 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 15 Oct 2011 22:01:29 -0400 (EDT) Received: (from kaduk@localhost) by multics.mit.edu (8.12.9.20060308) id p9G21Q5Z002037; Sat, 15 Oct 2011 22:01:26 -0400 (EDT) Date: Sat, 15 Oct 2011 22:01:26 -0400 (EDT) From: Benjamin Kaduk To: Eitan Adler In-Reply-To: Message-ID: References: User-Agent: Alpine 1.10 (GSO 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLIsWRmVeSWpSXmKPExsUixG6novvLapafwbsOM4vtm/8xWiw60c7k wOQxbfNBNo8Zn+azBDBFcdmkpOZklqUW6dslcGXM6DzPVnCBqWLao/+MDYzdTF2MnBwSAiYS hzu/QdliEhfurWfrYuTiEBLYxygxY/pqdghnA6PEt33nmSCcA0wSd7/tYYRwGhglds5oYgHp ZxHQlti35wo7iM0moCIx881GNhBbREBN4t3rbqAGDg5mAUOJcxv8QcLCAgYSUw9/YgWxOQUC Jc4cWwt2Bq+AvcSWj8/BxggJBEi0PHsAFhcV0JFYvX8KC0SNoMTJmU/AbGYBS4lzf66zTWAU nIUkNQtJagEj0ypG2ZTcKt3cxMyc4tRk3eLkxLy81CJdU73czBK91JTSTYzgUHVR2sH486DS IUYBDkYlHt6FwBAWYk0sK67MPcQoycGkJMp71wIoxJeUn1KZkVicEV9UmpNafIhRgoNZSYQ3 M2umnxBvSmJlVWpRPkxKmoNFSZyXa6eDn5BAemJJanZqakFqEUxWhoNDSYJXFGSPYFFqempF WmZOCUKaiYMTZDgP0HAnkBre4oLE3OLMdIj8KUZFKXFeRZCEAEgiozQPrheWSl4xigO9Isxr A1LFA0xDcN2vgAYzAQ1+pQRydXFJIkJKqoGxuumkU4Bg/c0dT/66rxI3DpZ79na9shFbipHg 4YzWeyU8xucbpi6crvq8Uc9p3e/2/eli3Xxs5T48mfVbPv472qkvstDKZ1ZJcLUcn/aH7+Xi sxqnXGiazmpWsLb1+9Vt//qf1/8/vGXLm2LZC6fqr6g8iH+hvqg46e8uWQa+7E+B4cJ+Z5qU WIozEg21mIuKEwEQytNXAAMAAA== Cc: FreeBSD Hackers Subject: Re: rtadvd - WARNS and a missing break? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2011 02:16:33 -0000 On Sat, 15 Oct 2011, Eitan Adler wrote: > I was playing around with WARNS on some programs and noticed that > usr.sbin/rtadvd builds with WARNS=3 with both clang and gcc (and > WARNS=6 with gcc). Perhaps the following could be committed ? WARNS changes should be verified by make universe; was that your testing? -Ben Kaduk From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 16 13:36:16 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 973BD1065674 for ; Sun, 16 Oct 2011 13:36:16 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 1AC858FC0C for ; Sun, 16 Oct 2011 13:36:15 +0000 (UTC) Received: by wwi18 with SMTP id 18so1962385wwi.31 for ; Sun, 16 Oct 2011 06:36:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=BpMwV0mmgLtV2JMjioLZS4bmRVMccqKWQxQePufh6b8=; b=fZ9OYcsYo0boP34/A+wx7SSYavS31mltPbL2UKYDV51jca/F0rETm/uPQO+O8SuXKS te7h95RKynqtsUMNwZTfNZEtvqDa8NSI5BFCRgRG3rReCd75CcWXAGWwQwY7YXnugE7M 9LoMJjOSVmYzPnT8uWuQ/7eW11alMa++t64os= Received: by 10.227.120.205 with SMTP id e13mr4897395wbr.98.1318772175091; Sun, 16 Oct 2011 06:36:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.200.72 with HTTP; Sun, 16 Oct 2011 06:35:45 -0700 (PDT) In-Reply-To: References: From: Eitan Adler Date: Sun, 16 Oct 2011 09:35:45 -0400 Message-ID: To: Benjamin Kaduk Content-Type: text/plain; charset=UTF-8 Cc: FreeBSD Hackers Subject: Re: rtadvd - WARNS and a missing break? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2011 13:36:16 -0000 On Sat, Oct 15, 2011 at 10:01 PM, Benjamin Kaduk wrote: > On Sat, 15 Oct 2011, Eitan Adler wrote: > >> I was playing around with WARNS on some programs and noticed that >> usr.sbin/rtadvd builds with WARNS=3 with both clang and gcc (and >> WARNS=6 with gcc). Perhaps the following could be committed ? > > WARNS changes should be verified by make universe; was that your testing? It wasn't. However after getting your email I ran make universe and it appears all builds were successful. > > -Ben Kaduk > -- Eitan Adler From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 16 17:10:23 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84268106581E; Sun, 16 Oct 2011 17:10:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 9E2C78FC17; Sun, 16 Oct 2011 17:10:22 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p9GHA5Ye053646 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 16 Oct 2011 20:10:05 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id p9GHA5Fo050708; Sun, 16 Oct 2011 20:10:05 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id p9GHA5JS050707; Sun, 16 Oct 2011 20:10:05 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 16 Oct 2011 20:10:05 +0300 From: Kostik Belousov To: Mikolaj Golub Message-ID: <20111016171005.GB50300@deviant.kiev.zoral.com.ua> References: <86y5wkeuw9.fsf@kopusha.home.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="v9Ux+11Zm5mwPlX6" Content-Disposition: inline In-Reply-To: <86y5wkeuw9.fsf@kopusha.home.net> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-hackers@freebsd.org, Robert Watson Subject: Re: "ps -e" without procfs(5) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2011 17:10:23 -0000 --v9Ux+11Zm5mwPlX6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Oct 16, 2011 at 07:57:57PM +0300, Mikolaj Golub wrote: > Hi, >=20 > I have a patch that makes kvm_uread() read from user space using ptrace(2= ). >=20 > http://people.freebsd.org/~trociny/kvm_uread.ptrace.patch >=20 > With this change 'ps -e' does not requires procfs(5). >=20 > Do you like it or there might be some reasons why it is a bad idea? >=20 > Grepping sources it looks like currently only ps uses kvm_getenvv(3) (and= thus > kvm_uread()). >=20 > Note, when reading from its own user space it just does bcopy(3), so if a > wrong address range is passed to kvm_uread() the program will segfault. D= o we > need some protection here and what? Masking SIGSEGV? Ptracing a random process may have a disastrous consequences for the traced process, caller or system. For the process, the ptrace(2) can cause spurious signal delivery or EINTR returns. If the process you attached to is critical for the system operatio= n, you can get hung or failed system. In my opinion, the way to implement the feature is to (re)use linprocfs_doargv() and provide another kern.proc sysctl to retrieve the argv and env vectors. Then, ps(1) and procstat(1) can use it, as well as procfs and linprocfs inside the kernel. While you are at the code, it would be useful to also export the auxv vecto= r, which is immediately before env. --v9Ux+11Zm5mwPlX6 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEUEARECAAYFAk6bD+0ACgkQC3+MBN1Mb4gUHQCeIrgATdu4B/y00uhBeWP1OxEi oiIAkgL4Qm5nLQpUlSuO0HoynlWFw3c= =4+U2 -----END PGP SIGNATURE----- --v9Ux+11Zm5mwPlX6-- From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 16 17:27:30 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1879F1065670 for ; Sun, 16 Oct 2011 17:27:30 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9E5798FC0A for ; Sun, 16 Oct 2011 17:27:29 +0000 (UTC) Received: by bkbzu17 with SMTP id zu17so2816448bkb.13 for ; Sun, 16 Oct 2011 10:27:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:sender:date:message-id:user-agent:mime-version :content-type; bh=7hb/kpHMiotc4Y8f63duAzDrUMJwx+cY1a5DUaipnAs=; b=yGMNFcbc1Ax83DJj/0+Irl7/YNLauYvv5a5+Qp0ZMO4VzcpYTEDAX5EvyME8QdpnSg CCA++MhkDA4TniXCblWcV/Lb3SKpRROfXu5gAIeNOSfjLM58DNHDqxR7hc1Sna3D5H64 XOaosWvb33UIQcicJ5TY+yZz5IT3RXm1CIrHQ= Received: by 10.223.15.10 with SMTP id i10mr18508757faa.17.1318784281422; Sun, 16 Oct 2011 09:58:01 -0700 (PDT) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id o22sm18201921fab.11.2011.10.16.09.57.59 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 16 Oct 2011 09:58:00 -0700 (PDT) From: Mikolaj Golub To: freebsd-hackers@freebsd.org Sender: Mikolaj Golub Date: Sun, 16 Oct 2011 19:57:57 +0300 Message-ID: <86y5wkeuw9.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Kostik Belousov , Robert Watson Subject: "ps -e" without procfs(5) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2011 17:27:30 -0000 Hi, I have a patch that makes kvm_uread() read from user space using ptrace(2). http://people.freebsd.org/~trociny/kvm_uread.ptrace.patch With this change 'ps -e' does not requires procfs(5). Do you like it or there might be some reasons why it is a bad idea? Grepping sources it looks like currently only ps uses kvm_getenvv(3) (and thus kvm_uread()). Note, when reading from its own user space it just does bcopy(3), so if a wrong address range is passed to kvm_uread() the program will segfault. Do we need some protection here and what? Masking SIGSEGV? -- Mikolaj Golub From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 08:11:15 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 243A9106566B for ; Thu, 20 Oct 2011 08:11:15 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [89.206.35.99]) by mx1.freebsd.org (Postfix) with ESMTP id 8A4D88FC08 for ; Thu, 20 Oct 2011 08:11:14 +0000 (UTC) Received: from wojtek.tensor.gdynia.pl (localhost [127.0.0.1]) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4) with ESMTP id p9K7fPxO033497 for ; Thu, 20 Oct 2011 09:41:25 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4/Submit) with ESMTP id p9K7fPmX033494 for ; Thu, 20 Oct 2011 09:41:25 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Thu, 20 Oct 2011 09:41:24 +0200 (CEST) From: Wojciech Puchar To: freebsd-hackers@freebsd.org Message-ID: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (wojtek.tensor.gdynia.pl [127.0.0.1]); Thu, 20 Oct 2011 09:41:25 +0200 (CEST) Subject: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 08:11:15 -0000 how to do this and what the hell it is used at all? i found somewhere it is some debugging info but i do not put -g option to compiler while compiling and still get substantial amount of this trash. trying strip -R .eh_frame -R .eh_frame_hdr results in working but LARGER binary, padded with lots of binary zeros. as the resulting program is working fine it proves that it is not needed at all, but i have no idea why this zero padding From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 08:23:03 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B615E106566B for ; Thu, 20 Oct 2011 08:23:03 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from mo-p00-ob6.rzone.de (mo-p00-ob6.rzone.de [IPv6:2a01:238:20a:202:53f0::1]) by mx1.freebsd.org (Postfix) with ESMTP id 508AA8FC0A for ; Thu, 20 Oct 2011 08:23:03 +0000 (UTC) X-RZG-AUTH: :JiIXek6mfvEEUpFQdo7Fj1/zg48CFjWjQv0cW+St/nW/afgnryVtiSTT7K/x6Ts= X-RZG-CLASS-ID: mo00 Received: from britannica.bec.de (ip-109-84-221-78.web.vodafone.de [109.84.221.78]) by smtp.strato.de (klopstock mo3) (RZmta 26.10 AUTH) with (DHE-RSA-AES128-SHA encrypted) ESMTPA id g06400n9K7NR0Z for ; Thu, 20 Oct 2011 10:22:38 +0200 (MEST) Received: by britannica.bec.de (sSMTP sendmail emulation); Thu, 20 Oct 2011 10:22:34 +0200 Date: Thu, 20 Oct 2011 10:22:34 +0200 From: Joerg Sonnenberger To: freebsd-hackers@freebsd.org Message-ID: <20111020082234.GA4568@britannica.bec.de> Mail-Followup-To: freebsd-hackers@freebsd.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 08:23:03 -0000 On Thu, Oct 20, 2011 at 09:41:24AM +0200, Wojciech Puchar wrote: > how to do this and what the hell it is used at all? It is used to allow unwinding stack frames. That is required for exception handling with C++ and also to allow debugging in the presence of -fomit-frame-pointer, e.g. as used by default on AMD64. Joerg From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 10:44:40 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1DB010656D2 for ; Thu, 20 Oct 2011 10:44:40 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [89.206.35.99]) by mx1.freebsd.org (Postfix) with ESMTP id 1002B8FC17 for ; Thu, 20 Oct 2011 10:44:39 +0000 (UTC) Received: from wojtek.tensor.gdynia.pl (localhost [127.0.0.1]) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4) with ESMTP id p9KAiaVQ036833; Thu, 20 Oct 2011 12:44:36 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4/Submit) with ESMTP id p9KAiZ58036830; Thu, 20 Oct 2011 12:44:35 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Thu, 20 Oct 2011 12:44:34 +0200 (CEST) From: Wojciech Puchar To: Joerg Sonnenberger In-Reply-To: <20111020082234.GA4568@britannica.bec.de> Message-ID: References: <20111020082234.GA4568@britannica.bec.de> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (wojtek.tensor.gdynia.pl [127.0.0.1]); Thu, 20 Oct 2011 12:44:36 +0200 (CEST) Cc: freebsd-hackers@freebsd.org Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 10:44:40 -0000 i both don't use C++ and don't want to debug when i am linking final binary. how to turn this off? On Thu, 20 Oct 2011, Joerg Sonnenberger wrote: > On Thu, Oct 20, 2011 at 09:41:24AM +0200, Wojciech Puchar wrote: >> how to do this and what the hell it is used at all? > > It is used to allow unwinding stack frames. That is required for > exception handling with C++ and also to allow debugging in the presence > of -fomit-frame-pointer, e.g. as used by default on AMD64. > > Joerg > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 12:03:01 2011 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12DBD1065675 for ; Thu, 20 Oct 2011 12:03:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 46FB08FC1E for ; Thu, 20 Oct 2011 12:03:00 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id PAA18793; Thu, 20 Oct 2011 15:02:56 +0300 (EEST) (envelope-from avg@FreeBSD.org) Message-ID: <4EA00DEF.3030905@FreeBSD.org> Date: Thu, 20 Oct 2011 15:02:55 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0.1) Gecko/20111003 Thunderbird/7.0.1 MIME-Version: 1.0 To: Wojciech Puchar References: <20111020082234.GA4568@britannica.bec.de> In-Reply-To: X-Enigmail-Version: undefined Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-hackers Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 12:03:01 -0000 on 20/10/2011 13:44 Wojciech Puchar said the following: > i both don't use C++ and don't want to debug when i am linking final binary. > > how to turn this off? Which compiler do you use? -- Andriy Gapon From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 12:13:23 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37BF3106566B for ; Thu, 20 Oct 2011 12:13:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id ECF908FC16 for ; Thu, 20 Oct 2011 12:13:22 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:21e3:f32f:69c1:7b24] (unknown [IPv6:2001:7b8:3a7:0:21e3:f32f:69c1:7b24]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id CFEEB5C37; Thu, 20 Oct 2011 14:13:21 +0200 (CEST) Message-ID: <4EA01063.8040304@FreeBSD.org> Date: Thu, 20 Oct 2011 14:13:23 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111012 Thunderbird/8.0 MIME-Version: 1.0 To: Wojciech Puchar References: <20111020082234.GA4568@britannica.bec.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, Joerg Sonnenberger Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 12:13:23 -0000 On 2011-10-20 12:44, Wojciech Puchar wrote: > i both don't use C++ and don't want to debug when i am linking final > binary. > > how to turn this off? objcopy --remove-section .eh_frame_hdr --remove-section .eh_frame --remove-section .rel.eh_frame --remove-section .rela.eh_frame $your_executable No warranty for any blown-off extremities, though. From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 12:24:50 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF5AF106564A for ; Thu, 20 Oct 2011 12:24:50 +0000 (UTC) (envelope-from lichray@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 37C778FC0A for ; Thu, 20 Oct 2011 12:24:49 +0000 (UTC) Received: by eyd10 with SMTP id 10so3672960eyd.13 for ; Thu, 20 Oct 2011 05:24:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=7lxAilYrSnkXEuoRRXQ8gPg5uroZjvH3KPs4ePvtCBo=; b=YSVeXB4BVH4R43j8BCoy5k1FWC+KpOsQqZmi6Op6hCBS+TiMLNgF7zXULUz2v9c+Ev LEWbliUTnvmNd9zfCpzbMDW4crjAusB8thRgvkcab+iRqKOA0HujXPGbSXaJF/aG0yoj nlGmZsdLhrffA5r+cdNzzPwVWl/iBZNEcXn4Q= MIME-Version: 1.0 Received: by 10.213.27.204 with SMTP id j12mr2260841ebc.141.1319113488461; Thu, 20 Oct 2011 05:24:48 -0700 (PDT) Received: by 10.213.113.10 with HTTP; Thu, 20 Oct 2011 05:24:48 -0700 (PDT) In-Reply-To: <4EA01063.8040304@FreeBSD.org> References: <20111020082234.GA4568@britannica.bec.de> <4EA01063.8040304@FreeBSD.org> Date: Thu, 20 Oct 2011 07:24:48 -0500 Message-ID: From: Zhihao Yuan To: Dimitry Andric Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Wojciech Puchar , Joerg Sonnenberger , freebsd-hackers@freebsd.org Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 12:24:51 -0000 On Thu, Oct 20, 2011 at 7:13 AM, Dimitry Andric wrote: > On 2011-10-20 12:44, Wojciech Puchar wrote: > >> i both don't use C++ and don't want to debug when i am linking final >> binary. >> >> how to turn this off? >> > > objcopy --remove-section .eh_frame_hdr --remove-section .eh_frame > --remove-section .rel.eh_frame --remove-section .rela.eh_frame > $your_executable > After I done this, the binary size *increased* a lot, while objdump shows that the content is less. I don't understand. > > No warranty for any blown-off extremities, though. > > ______________________________**_________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/**mailman/listinfo/freebsd-**hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@** > freebsd.org " > -- Zhihao Yuan, nickname lichray The best way to predict the future is to invent it. ___________________________________________________ 4BSD -- http://4bsd.biz/ From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 18:23:06 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2058A106566B for ; Thu, 20 Oct 2011 18:23:06 +0000 (UTC) (envelope-from strontium90@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id A8BF28FC0A for ; Thu, 20 Oct 2011 18:23:05 +0000 (UTC) Received: by wwi18 with SMTP id 18so4556773wwi.31 for ; Thu, 20 Oct 2011 11:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=eo0wlcGhPYo6vNWJDEXD4LrDzzPxCsIHVWex5l5jJ0s=; b=gm3N1b2JfsF8hNS3ZVBlyT9G7WObeuMrZTWjkYhO/67nWkvLRT4o8H0xsk5MLqJI0D uRjSTJFwHz2+A1Ex6gurMjmUEzBuqbRxaDLcRdleYB/ODA2IkDsIow0rSWss78DVppan a4aLxhWK2bflkbidgy5tKfARLGUn7N/Bm5w2Y= Received: by 10.227.7.94 with SMTP id c30mr4296508wbc.44.1319133482873; Thu, 20 Oct 2011 10:58:02 -0700 (PDT) Received: from iv-sv-328.creatis.insa-lyon.fr (iv-sv-328.creatis.insa-lyon.fr. [195.220.108.195]) by mx.google.com with ESMTPS id o17sm15045811wbm.6.2011.10.20.10.58.00 (version=SSLv3 cipher=OTHER); Thu, 20 Oct 2011 10:58:01 -0700 (PDT) Message-ID: <4EA0610B.90206@gmail.com> Date: Thu, 20 Oct 2011 19:57:31 +0200 From: Razmig K User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0) Gecko/20111003 Thunderbird/7.0 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Measuring memory footprint in C/C++ code on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 18:23:06 -0000 Hello I'd like to measure the memory footprint in C/C++ code for a program running under FreeBSD and Linux in terms of total process size including heap objects. Due to execution length, I'd like to avoid the use of valgrind. I think that it would be difficult to achieve the task in a platform-transparent manner, that's why I'll be using /proc//status on Linux, and do something else on FreeBSD. I was adviced to have a look on getrusage, which I did, but I found descriptions of certain fields of struct rusage in the manpage too cryptic to make a proper use of the call. Could someone please point me in the right direction? Thanks very much. ~Razmig From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 22:20:58 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C4CE106566B for ; Thu, 20 Oct 2011 22:20:58 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [89.206.35.99]) by mx1.freebsd.org (Postfix) with ESMTP id 986A88FC12 for ; Thu, 20 Oct 2011 22:20:56 +0000 (UTC) Received: from wojtek.tensor.gdynia.pl (localhost [127.0.0.1]) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4) with ESMTP id p9KMKqXP008910; Fri, 21 Oct 2011 00:20:52 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4/Submit) with ESMTP id p9KMKqnr008907; Fri, 21 Oct 2011 00:20:52 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Fri, 21 Oct 2011 00:20:52 +0200 (CEST) From: Wojciech Puchar To: Andriy Gapon In-Reply-To: <4EA00DEF.3030905@FreeBSD.org> Message-ID: References: <20111020082234.GA4568@britannica.bec.de> <4EA00DEF.3030905@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (wojtek.tensor.gdynia.pl [127.0.0.1]); Fri, 21 Oct 2011 00:20:53 +0200 (CEST) Cc: freebsd-hackers Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 22:20:58 -0000 >> i both don't use C++ and don't want to debug when i am linking final binary. >> >> how to turn this off? > > Which compiler do you use? supplied with FreeBSD 8.2 [wojtek@wojtek ~]$ cc -v Using built-in specs. Target: amd64-undermydesk-freebsd Configured with: FreeBSD/amd64 system compiler Thread model: posix gcc version 4.2.2 20070831 prerelease [FreeBSD] > > -- > Andriy Gapon > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 22:22:15 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21A91106564A for ; Thu, 20 Oct 2011 22:22:15 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [89.206.35.99]) by mx1.freebsd.org (Postfix) with ESMTP id 74C258FC1B for ; Thu, 20 Oct 2011 22:22:14 +0000 (UTC) Received: from wojtek.tensor.gdynia.pl (localhost [127.0.0.1]) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4) with ESMTP id p9KMMBsI008947; Fri, 21 Oct 2011 00:22:11 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4/Submit) with ESMTP id p9KMMAJj008944; Fri, 21 Oct 2011 00:22:10 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Fri, 21 Oct 2011 00:22:10 +0200 (CEST) From: Wojciech Puchar To: Dimitry Andric In-Reply-To: <4EA01063.8040304@FreeBSD.org> Message-ID: References: <20111020082234.GA4568@britannica.bec.de> <4EA01063.8040304@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (wojtek.tensor.gdynia.pl [127.0.0.1]); Fri, 21 Oct 2011 00:22:11 +0200 (CEST) Cc: freebsd-hackers@freebsd.org, Joerg Sonnenberger Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 22:22:15 -0000 this do the same that strip -R .... what i already tried and as i already wrote - the same results. program is working and sections are stripped but i am getting ca 1MB of binary zero paddings. From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 22:24:49 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80DDA106566C for ; Thu, 20 Oct 2011 22:24:49 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [89.206.35.99]) by mx1.freebsd.org (Postfix) with ESMTP id E13E08FC0C for ; Thu, 20 Oct 2011 22:24:48 +0000 (UTC) Received: from wojtek.tensor.gdynia.pl (localhost [127.0.0.1]) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4) with ESMTP id p9KMOjFn009066; Fri, 21 Oct 2011 00:24:45 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4/Submit) with ESMTP id p9KMOjXa009063; Fri, 21 Oct 2011 00:24:45 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Fri, 21 Oct 2011 00:24:45 +0200 (CEST) From: Wojciech Puchar To: Zhihao Yuan In-Reply-To: Message-ID: References: <20111020082234.GA4568@britannica.bec.de> <4EA01063.8040304@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (wojtek.tensor.gdynia.pl [127.0.0.1]); Fri, 21 Oct 2011 00:24:45 +0200 (CEST) Cc: freebsd-hackers@freebsd.org, Dimitry Andric , Joerg Sonnenberger Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 22:24:49 -0000 > > > After I done this, the binary size *increased* a lot, while objdump shows that the content is less. I don't understand. same for me strip -R .eh_frame -R .eh_frame_hdr do the same. From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 22:34:25 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A71A106566C for ; Thu, 20 Oct 2011 22:34:25 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id 068088FC16 for ; Thu, 20 Oct 2011 22:34:24 +0000 (UTC) Received: from ur.dons.net.au (ppp118-210-211-94.lns20.adl6.internode.on.net [118.210.211.94]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id p9KMYHaw068904 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 21 Oct 2011 09:04:23 +1030 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset=iso-8859-1 From: "Daniel O'Connor" In-Reply-To: <4EA0610B.90206@gmail.com> Date: Fri, 21 Oct 2011 09:04:17 +1030 Content-Transfer-Encoding: quoted-printable Message-Id: References: <4EA0610B.90206@gmail.com> To: Razmig K X-Mailer: Apple Mail (2.1244.3) X-Spam-Score: 2.162 (**) BAYES_00,KHOP_DYNAMIC,RDNS_DYNAMIC X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: freebsd-hackers@freebsd.org Subject: Re: Measuring memory footprint in C/C++ code on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 22:34:25 -0000 On 21/10/2011, at 4:27, Razmig K wrote: > I think that it would be difficult to achieve the task in a = platform-transparent manner, that's why I'll be using /proc//status = on Linux, and do something else on FreeBSD. > I was adviced to have a look on getrusage, which I did, but I found = descriptions of certain fields of struct rusage in the manpage too = cryptic to make a proper use of the call. > Could someone please point me in the right direction? getrusage should be portable and the man page (at least on FreeBSD) = explains each of the fields. -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 23:05:19 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BC91106564A; Thu, 20 Oct 2011 23:05:19 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [89.206.35.99]) by mx1.freebsd.org (Postfix) with ESMTP id 905618FC0C; Thu, 20 Oct 2011 23:05:18 +0000 (UTC) Received: from wojtek.tensor.gdynia.pl (localhost [127.0.0.1]) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4) with ESMTP id p9KN5FEt001625; Fri, 21 Oct 2011 01:05:15 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4/Submit) with ESMTP id p9KN5F3K001614; Fri, 21 Oct 2011 01:05:15 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Fri, 21 Oct 2011 01:05:15 +0200 (CEST) From: Wojciech Puchar To: Zhihao Yuan In-Reply-To: Message-ID: References: <20111020082234.GA4568@britannica.bec.de> <4EA01063.8040304@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (wojtek.tensor.gdynia.pl [127.0.0.1]); Fri, 21 Oct 2011 01:05:15 +0200 (CEST) Cc: Joerg Sonnenberger , Dimitry Andric , freebsd-hackers@freebsd.org Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 23:05:19 -0000 >> --remove-section .rel.eh_frame --remove-section .rela.eh_frame >> $your_executable >> > > After I done this, the binary size *increased* a lot, while objdump shows > that the content is less. I don't understand. > add -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables -fno-unwind-tables when compiling with gcc and this trash is not produced at first place. From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 23:14:02 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3D57106566C for ; Thu, 20 Oct 2011 23:14:02 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [89.206.35.99]) by mx1.freebsd.org (Postfix) with ESMTP id 4ED528FC0C for ; Thu, 20 Oct 2011 23:14:01 +0000 (UTC) Received: from wojtek.tensor.gdynia.pl (localhost [127.0.0.1]) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4) with ESMTP id p9KNDxtu003751; Fri, 21 Oct 2011 01:13:59 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4/Submit) with ESMTP id p9KNDxOY003748; Fri, 21 Oct 2011 01:13:59 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Fri, 21 Oct 2011 01:13:59 +0200 (CEST) From: Wojciech Puchar To: Alexander Kabaev In-Reply-To: <20111020190553.6bf95790@kan.dnsalias.net> Message-ID: References: <20111020082234.GA4568@britannica.bec.de> <4EA00DEF.3030905@FreeBSD.org> <20111020190553.6bf95790@kan.dnsalias.net> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (wojtek.tensor.gdynia.pl [127.0.0.1]); Fri, 21 Oct 2011 01:13:59 +0200 (CEST) Cc: freebsd-hackers Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 23:14:03 -0000 > > -fno-asynchronous-unwind-tables should get rid of unwind information, > a.k.a. 'crap'. and this worked. found it just before getting your mail ;) yes and this is crap... possibly it is needed for some cases and some languages and i would not call it crap if it would not be included by default! From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 23:27:00 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD0AD106564A for ; Thu, 20 Oct 2011 23:27:00 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 9248D8FC1B for ; Thu, 20 Oct 2011 23:27:00 +0000 (UTC) Received: by qyk35 with SMTP id 35so137484qyk.13 for ; Thu, 20 Oct 2011 16:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; bh=i1VTxJ6yefJtyayPP2ot5GnxAXLTlGRo9o3Px1Tq9lQ=; b=h1G7JaxBse1Eae7hBXNBqHqYwhVcpjv+BUeT4K7bPmgjpkmhW+yUanC3OrNGLlsONm MXIwqxvCuV9S9Sfk4nu6Ez+MNsg4Aq3Iqiop3vN+ZPZ5icmN7fnAUWcdV2kCGtC11624 l5cVvSJdMVN6Y/qgV+ZXnnFpQGN8rrVyOnv8E= Received: by 10.229.191.2 with SMTP id dk2mr2811376qcb.32.1319153219761; Thu, 20 Oct 2011 16:26:59 -0700 (PDT) Received: from kan.dnsalias.net (c-24-63-226-98.hsd1.ma.comcast.net. [24.63.226.98]) by mx.google.com with ESMTPS id et6sm12730875qab.4.2011.10.20.16.26.58 (version=SSLv3 cipher=OTHER); Thu, 20 Oct 2011 16:26:58 -0700 (PDT) Date: Thu, 20 Oct 2011 19:26:53 -0400 From: Alexander Kabaev To: Wojciech Puchar Message-ID: <20111020192653.6425f018@kan.dnsalias.net> In-Reply-To: References: <20111020082234.GA4568@britannica.bec.de> <4EA00DEF.3030905@FreeBSD.org> <20111020190553.6bf95790@kan.dnsalias.net> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.6; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/F503ngxMWnX_O=j6uT5A6Bp"; protocol="application/pgp-signature" Cc: freebsd-hackers Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 23:27:00 -0000 --Sig_/F503ngxMWnX_O=j6uT5A6Bp Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 21 Oct 2011 01:13:59 +0200 (CEST) Wojciech Puchar wrote: > > > > -fno-asynchronous-unwind-tables should get rid of unwind > > information, a.k.a. 'crap'. > and this worked. found it just before getting your mail ;) >=20 > yes and this is crap... possibly it is needed for some cases and some=20 > languages and i would not call it crap if it would not be included by=20 > default! >=20 It is part of the amd64 ABI, which defaults to not pushing stack frames on entry into each function, which is different from usual x86 convention. Asynchronous unwind info (yeah, same stuff you keep referring to as crap), is the only way you can debug your program or get anything remotely close to usable backtrace, by default.=20 --=20 Alexander Kabaev --Sig_/F503ngxMWnX_O=j6uT5A6Bp Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iD8DBQFOoK5BQ6z1jMm+XZYRAtk2AJ92KPoQXkB2CFJ68RacW1YCauKodACg5DaQ ps59JlduD1xr2dJGJZTwzw4= =0Gt3 -----END PGP SIGNATURE----- --Sig_/F503ngxMWnX_O=j6uT5A6Bp-- From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 23:37:39 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CEE9106564A for ; Thu, 20 Oct 2011 23:37:39 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id B07678FC14 for ; Thu, 20 Oct 2011 23:37:38 +0000 (UTC) Received: by vcbfo13 with SMTP id fo13so4517524vcb.13 for ; Thu, 20 Oct 2011 16:37:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; bh=dZCgQZm/mTPkBbB/MAXVA2vi1gF432ZWZA10ngy7sD4=; b=eRNFVcqqTgs2pis3zM1iODGMAPu6dmqDaxN6VKsEENUN/FEitnAgBMYwa6AxPaJiaM 8KBF/t9jahIDhk8JtrqhmdtO4yAEIHSMCdWJzRChtKGRo+x0K1949WiEDTC2Zo+XuS9J Dn7kirpl/SQ3QQomq00ZPgc5hoWirvVWvzKxg= Received: by 10.52.88.231 with SMTP id bj7mr12374461vdb.81.1319151962607; Thu, 20 Oct 2011 16:06:02 -0700 (PDT) Received: from kan.dnsalias.net (c-24-63-226-98.hsd1.ma.comcast.net. [24.63.226.98]) by mx.google.com with ESMTPS id bi11sm10554880vdb.13.2011.10.20.16.06.00 (version=SSLv3 cipher=OTHER); Thu, 20 Oct 2011 16:06:00 -0700 (PDT) Date: Thu, 20 Oct 2011 19:05:53 -0400 From: Alexander Kabaev To: Wojciech Puchar Message-ID: <20111020190553.6bf95790@kan.dnsalias.net> In-Reply-To: References: <20111020082234.GA4568@britannica.bec.de> <4EA00DEF.3030905@FreeBSD.org> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.6; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/WYiL5JRapGhg=uIFjwDrOD4"; protocol="application/pgp-signature" Cc: freebsd-hackers Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 23:37:39 -0000 --Sig_/WYiL5JRapGhg=uIFjwDrOD4 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 21 Oct 2011 00:20:52 +0200 (CEST) Wojciech Puchar wrote: > >> i both don't use C++ and don't want to debug when i am linking > >> final binary. > >> > >> how to turn this off? > > > > Which compiler do you use? >=20 > supplied with FreeBSD 8.2 > [wojtek@wojtek ~]$ cc -v > Using built-in specs. > Target: amd64-undermydesk-freebsd > Configured with: FreeBSD/amd64 system compiler > Thread model: posix > gcc version 4.2.2 20070831 prerelease [FreeBSD] >=20 -fno-asynchronous-unwind-tables should get rid of unwind information, a.k.a. 'crap'. --=20 Alexander Kabaev --Sig_/WYiL5JRapGhg=uIFjwDrOD4 Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iD8DBQFOoKlXQ6z1jMm+XZYRAn+nAJ0U7g4P6ieSKbPSV8yhLRInxdpTKQCeJqif Dcj/zA8WzIraQ1GQIocEQVY= =bogi -----END PGP SIGNATURE----- --Sig_/WYiL5JRapGhg=uIFjwDrOD4-- From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 21 07:51:34 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AF9A1065675 for ; Fri, 21 Oct 2011 07:51:34 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [89.206.35.99]) by mx1.freebsd.org (Postfix) with ESMTP id E00088FC1E for ; Fri, 21 Oct 2011 07:51:33 +0000 (UTC) Received: from wojtek.tensor.gdynia.pl (localhost [127.0.0.1]) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4) with ESMTP id p9L7pU2x011675; Fri, 21 Oct 2011 09:51:30 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4/Submit) with ESMTP id p9L7pUuT011672; Fri, 21 Oct 2011 09:51:30 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Fri, 21 Oct 2011 09:51:30 +0200 (CEST) From: Wojciech Puchar To: Alexander Kabaev In-Reply-To: <20111020192653.6425f018@kan.dnsalias.net> Message-ID: References: <20111020082234.GA4568@britannica.bec.de> <4EA00DEF.3030905@FreeBSD.org> <20111020190553.6bf95790@kan.dnsalias.net> <20111020192653.6425f018@kan.dnsalias.net> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (wojtek.tensor.gdynia.pl [127.0.0.1]); Fri, 21 Oct 2011 09:51:30 +0200 (CEST) Cc: freebsd-hackers Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 07:51:34 -0000 > on entry into each function, which is different from usual x86 > convention. > Asynchronous unwind info (yeah, same stuff you keep referring to as > crap), is the only way you can debug your program or get anything > remotely close to usable backtrace, by default. i understand but i DO NOT called compiler with -g option which clearly means that i do not want to debug isn't it? From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 21 07:54:34 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33D0A1065677 for ; Fri, 21 Oct 2011 07:54:34 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id E3F808FC12 for ; Fri, 21 Oct 2011 07:54:33 +0000 (UTC) Received: by ywm3 with SMTP id 3so4649567ywm.13 for ; Fri, 21 Oct 2011 00:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Zzm8HE1Bt/IQxlYu48SIcXzNjsCrg3pJYvHSvuMJsBQ=; b=d/fD5p3oHSx1q7WwRrbkYfnAToY+6jRvabumce2++DeHbBYGgmCOSzg+ixvph1UZbV S0QCwWQej2ScCkchXeYGyJXH0cR0KDL15PMm7cl8Vb70z+xlQLJV3EmXYFx0OdGt6/g+ 3+rfVKsviN3Xv6woeuCcubaGimRDWOD/M0L7A= MIME-Version: 1.0 Received: by 10.182.217.33 with SMTP id ov1mr878268obc.26.1319183673073; Fri, 21 Oct 2011 00:54:33 -0700 (PDT) Received: by 10.182.122.33 with HTTP; Fri, 21 Oct 2011 00:54:32 -0700 (PDT) In-Reply-To: References: <20111020082234.GA4568@britannica.bec.de> <4EA00DEF.3030905@FreeBSD.org> <20111020190553.6bf95790@kan.dnsalias.net> <20111020192653.6425f018@kan.dnsalias.net> Date: Fri, 21 Oct 2011 00:54:32 -0700 Message-ID: From: Garrett Cooper To: Wojciech Puchar Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-hackers Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 07:54:34 -0000 On Fri, Oct 21, 2011 at 12:51 AM, Wojciech Puchar wrote: >> on entry into each function, which is different from usual x86 >> convention. >> Asynchronous unwind info (yeah, same stuff you keep referring to as >> crap), is the only way you can debug your program or get anything >> remotely close to usable backtrace, by default. > > i understand but i DO NOT called compiler with -g option which clearly means > that i do not want to debug isn't it? It seems like a binutils bug (or somewhere in that immediate neighborhood) because all debugging related sections should be stripped out by strip including unwind, correct? Thanks, -Garrett From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 21 08:44:26 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 329AF106564A for ; Fri, 21 Oct 2011 08:44:26 +0000 (UTC) (envelope-from strontium90@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id B909B8FC13 for ; Fri, 21 Oct 2011 08:44:25 +0000 (UTC) Received: by wyi40 with SMTP id 40so4800853wyi.13 for ; Fri, 21 Oct 2011 01:44:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=hWYAO9rJ89jGyRK/X4l/YGFbzVptqpce2IVuEXoBwPc=; b=fh01ZOyVgtVeQ05PchIs9hKIhlwgD2Tp2pQOIsMdvZY1ML8D18iBKbAY4iFHO/aT/8 DZaHoUiNO3517+wyG32mDMqAm6AiQZM3xxsOeNc54fcbT9P50QUE8lew0xZYQKZqbT5w Fuwx52C1kl9ndvLM8a3o6ifn8THuzg9VL/+ME= Received: by 10.216.88.140 with SMTP id a12mr4876822wef.82.1319186664484; Fri, 21 Oct 2011 01:44:24 -0700 (PDT) Received: from iv-sv-328.creatis.insa-lyon.fr (iv-sv-328.creatis.insa-lyon.fr. [195.220.108.195]) by mx.google.com with ESMTPS id fy13sm20390521wbb.18.2011.10.21.01.44.22 (version=SSLv3 cipher=OTHER); Fri, 21 Oct 2011 01:44:23 -0700 (PDT) Message-ID: <4EA130E5.9060807@gmail.com> Date: Fri, 21 Oct 2011 10:44:21 +0200 From: Razmig K User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0) Gecko/20111003 Thunderbird/7.0 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <4EA0610B.90206@gmail.com> In-Reply-To: <4EA0610B.90206@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: Measuring memory footprint in C/C++ code on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 08:44:26 -0000 Le 20.10.2011 19:57, Razmig K a écrit : > the memory footprint in C/C++ code for a program running under FreeBSD > and Linux in terms of total process size including heap objects Well getrusage does actually exist in Linux, but its behaviour isn't the same as on FreeBSD; struct rusage memory usage information fields ru_ixrss (shared text), ru_idrss (unshared data) and ru_isrss (unshared stack) are always zero. To test and understand the behaviour of getrusage on FreeBSD, I have written a small C++ program that allocates several large double arrays on the stack as well as on the heap with few loops to delay execution, and tried using the aforementioned fields, in addition to ru_maxrss (max resident size) to deduce memory usage information of the program as reported by top, namely fields RES and SIZE, but somehow I didn't manage to get a result matching that of the latter. First of all, I'm not sure if I interpret man getrusage correctly. For ru_ixrss, it says that it is an "integral" value indicating the amount of memory used by the text segment that was also shared among other processes, and is expressed in units of kilobytes * ticks-of-execution, where ticks are statistics clock ticks, the statistics clock having a frequency of sysconf(_SC_CLK_TCK) ticks per second. Does this imply that I need to divide ru_ixrss by sysconf(_SC_CLK_TCK) * a certain number of seconds? In that case, what do I use for the latter? ru_stime or ru_utime? I have observed that unlike ru_idrss, ru_ixrss and ru_isrss depend on execution time which contradicts the manpage, since all three fields are supposed to be specified in the same unit. Lastly, I don't see how to use getrusage to deduce information on the program's heap use. As I said in my first message, I need to measure the memory footprint in terms of total process size including heap objects. Thanks again for any tips. ~Razmig From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 21 08:52:03 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3AC3A106566C for ; Fri, 21 Oct 2011 08:52:03 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [89.206.35.99]) by mx1.freebsd.org (Postfix) with ESMTP id 9ACCA8FC0A for ; Fri, 21 Oct 2011 08:52:02 +0000 (UTC) Received: from wojtek.tensor.gdynia.pl (localhost [127.0.0.1]) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4) with ESMTP id p9L8q1nx011982; Fri, 21 Oct 2011 10:52:01 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4/Submit) with ESMTP id p9L8q0gw011979; Fri, 21 Oct 2011 10:52:00 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Fri, 21 Oct 2011 10:52:00 +0200 (CEST) From: Wojciech Puchar To: Garrett Cooper In-Reply-To: Message-ID: References: <20111020082234.GA4568@britannica.bec.de> <4EA00DEF.3030905@FreeBSD.org> <20111020190553.6bf95790@kan.dnsalias.net> <20111020192653.6425f018@kan.dnsalias.net> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (wojtek.tensor.gdynia.pl [127.0.0.1]); Fri, 21 Oct 2011 10:52:01 +0200 (CEST) Cc: freebsd-hackers Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 08:52:03 -0000 >> that i do not want to debug isn't it? > > It seems like a binutils bug (or somewhere in that immediate > neighborhood) because all debugging related sections should be > stripped out by strip including unwind, correct? indeed. From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 21 10:19:13 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6B481065744 for ; Fri, 21 Oct 2011 10:19:13 +0000 (UTC) (envelope-from strontium90@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 5C88B8FC0A for ; Fri, 21 Oct 2011 10:19:12 +0000 (UTC) Received: by wyi40 with SMTP id 40so4925166wyi.13 for ; Fri, 21 Oct 2011 03:19:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=QZ9WpmKh82h/DhKCBly23aZcbir65rMjoxwjKu5X6Gc=; b=GqZZgpHTbpy3q/HnmovkyqZlHrpuf5Ihmrb3rWkjjKEp0IuzKIgEH/G96vOp80djd5 dmz82UUwjdeNh6uHxHqGifqIGwHYiWmnP+3E7X7uopcVafwL8OVqyJqOADez1WYM9sLZ Lo5jLZz8YtD/yT2JkYoCy6A2JjlroiF6Uaw4U= Received: by 10.227.20.65 with SMTP id e1mr5168207wbb.105.1319192351994; Fri, 21 Oct 2011 03:19:11 -0700 (PDT) Received: from iv-sv-328.creatis.insa-lyon.fr (iv-sv-328.creatis.insa-lyon.fr. [195.220.108.195]) by mx.google.com with ESMTPS id l42sm1940142wbn.16.2011.10.21.03.19.11 (version=SSLv3 cipher=OTHER); Fri, 21 Oct 2011 03:19:11 -0700 (PDT) Message-ID: <4EA1471E.9050501@gmail.com> Date: Fri, 21 Oct 2011 12:19:10 +0200 From: Razmig K User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0) Gecko/20111003 Thunderbird/7.0 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <4EA0610B.90206@gmail.com> <20111021084413.GA46039@server.vk2pj.dyndns.org> In-Reply-To: <20111021084413.GA46039@server.vk2pj.dyndns.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: Measuring memory footprint in C/C++ code on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 10:19:13 -0000 Le 21.10.2011 10:44, Peter Jeremy a écrit : > On 2011-Oct-20 19:57:31 +0200, Razmig K wrote: > It's not clear whether the program is attempting to determine it's > own (or a child's) memory footprint, or that of an arbitrary process. > In the former case, getrusage() is the obvious choice. This as a > portable interface. The program has to determine its own memory footprint. It has no children. > > If you want to examine arbitrary processes, the best interface on > FreeBSD would be kvm_getprocs(3). > > BTW, since you mention heap objects, I presume you are aware that > malloc() uses mmap(), rather than sbrk() to obtain memory. No I wasn't aware of that. In few words, the program needs to obtain and report information reported by the SIZE column of top, since it is going to be run many times, and it is impractical to watch top for this purpose. Thanks. ~Razmig From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 21 10:26:30 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3192D106564A for ; Fri, 21 Oct 2011 10:26:30 +0000 (UTC) (envelope-from freebsd-hackers@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id AEA228FC16 for ; Fri, 21 Oct 2011 10:26:29 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RHCJ2-0002Bl-J7 for freebsd-hackers@freebsd.org; Fri, 21 Oct 2011 12:26:28 +0200 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 21 Oct 2011 12:26:28 +0200 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 21 Oct 2011 12:26:28 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-hackers@freebsd.org From: Ivan Voras Date: Fri, 21 Oct 2011 12:26:17 +0200 Lines: 49 Message-ID: References: <4EA0610B.90206@gmail.com> <20111021084413.GA46039@server.vk2pj.dyndns.org> <4EA1471E.9050501@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigC69AF980CD066BDBF1788C0A" X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0.1) Gecko/20111004 Thunderbird/7.0.1 In-Reply-To: <4EA1471E.9050501@gmail.com> X-Enigmail-Version: 1.1.2 Subject: Re: Measuring memory footprint in C/C++ code on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 10:26:30 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigC69AF980CD066BDBF1788C0A Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 21/10/2011 12:19, Razmig K wrote: > Le 21.10.2011 10:44, Peter Jeremy a =C3=A9crit : >> On 2011-Oct-20 19:57:31 +0200, Razmig K wrote:= >> It's not clear whether the program is attempting to determine it's >> own (or a child's) memory footprint, or that of an arbitrary process. >> In the former case, getrusage() is the obvious choice. This as a >> portable interface. > The program has to determine its own memory footprint. It has no childr= en. >=20 >> >> If you want to examine arbitrary processes, the best interface on >> FreeBSD would be kvm_getprocs(3). >> >> BTW, since you mention heap objects, I presume you are aware that >> malloc() uses mmap(), rather than sbrk() to obtain memory. > No I wasn't aware of that. >=20 > In few words, the program needs to obtain and report information > reported by the SIZE column of top, since it is going to be run many > times, and it is impractical to watch top for this purpose. Well, do you know that SIZE in top is virtual memory size, not resident size (which is the "RES" column)? You can allocate whatever you want from virtual memory, it is not "used" until it's touched. --------------enigC69AF980CD066BDBF1788C0A Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk6hSMkACgkQldnAQVacBchCngCgy6qNnCqLWK4oZyde6It+J+SG CgsAnjXMjfNGvEgqmZ571ZOOzq4uEQVG =q+by -----END PGP SIGNATURE----- --------------enigC69AF980CD066BDBF1788C0A-- From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 21 10:57:20 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97BF1106564A for ; Fri, 21 Oct 2011 10:57:20 +0000 (UTC) (envelope-from strontium90@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 2AF7E8FC13 for ; Fri, 21 Oct 2011 10:57:19 +0000 (UTC) Received: by wyi40 with SMTP id 40so4975448wyi.13 for ; Fri, 21 Oct 2011 03:57:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=lwdOmRfbRd+tUCfZzG2O82Lh4TyczSrkh7gOycosRfg=; b=DJUVc8OzS/V/OCvdzl8q060XlUAG+vyQr8WYRdMR44fGXJWU+k3ZTIkehjLkyl7ESJ lEHrSOpM10yY2DolhwJhKE6EFzIG8CSO2JQRQFiWKL/4mrc0S3Xban9AA47O6NswzeE1 kBBKX1LaYnmPdu3LNp1c0GbQkb7it/fKfmh/0= Received: by 10.216.131.12 with SMTP id l12mr6654665wei.95.1319194639118; Fri, 21 Oct 2011 03:57:19 -0700 (PDT) Received: from iv-sv-328.creatis.insa-lyon.fr (iv-sv-328.creatis.insa-lyon.fr. [195.220.108.195]) by mx.google.com with ESMTPS id l42sm2125622wbn.16.2011.10.21.03.57.17 (version=SSLv3 cipher=OTHER); Fri, 21 Oct 2011 03:57:18 -0700 (PDT) Message-ID: <4EA15004.50308@gmail.com> Date: Fri, 21 Oct 2011 12:57:08 +0200 From: Razmig K User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0) Gecko/20111003 Thunderbird/7.0 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <4EA0610B.90206@gmail.com> <20111021084413.GA46039@server.vk2pj.dyndns.org> <4EA1471E.9050501@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: Measuring memory footprint in C/C++ code on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 10:57:20 -0000 Le 21.10.2011 12:26, Ivan Voras a écrit : > Well, do you know that SIZE in top is virtual memory size, not resident > size (which is the "RES" column)? You can allocate whatever you want > from virtual memory, it is not "used" until it's touched. Yes, I do. So do you suggest using RES as a better indicator of memory footprint? The program in question processes large 3D images via vtk, and I'd like to measure its memory usgae with different parameter configurations as the maximum amount of memory acquired during execution. Since SIZE often happens to be larger than RES, and increase more during execution, I thought of using it as an indicator of memory footprint. ~Razmig From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 21 11:05:19 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89BA3106564A for ; Fri, 21 Oct 2011 11:05:19 +0000 (UTC) (envelope-from peterjeremy@acm.org) Received: from fallbackmx06.syd.optusnet.com.au (fallbackmx06.syd.optusnet.com.au [211.29.132.8]) by mx1.freebsd.org (Postfix) with ESMTP id 199888FC08 for ; Fri, 21 Oct 2011 11:05:18 +0000 (UTC) Received: from mail26.syd.optusnet.com.au (mail26.syd.optusnet.com.au [211.29.133.167]) by fallbackmx06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p9L9NYWX012246 for ; Fri, 21 Oct 2011 20:23:34 +1100 Received: from server.vk2pj.dyndns.org (c220-239-116-103.belrs4.nsw.optusnet.com.au [220.239.116.103]) by mail26.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p9L9NUaZ019845 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 21 Oct 2011 20:23:32 +1100 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.5/8.14.4) with ESMTP id p9L8iEjR046084; Fri, 21 Oct 2011 19:44:14 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.5/8.14.4/Submit) id p9L8iELu046083; Fri, 21 Oct 2011 19:44:14 +1100 (EST) (envelope-from peter) Date: Fri, 21 Oct 2011 19:44:13 +1100 From: Peter Jeremy To: Razmig K Message-ID: <20111021084413.GA46039@server.vk2pj.dyndns.org> References: <4EA0610B.90206@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3MwIy2ne0vdjdPXF" Content-Disposition: inline In-Reply-To: <4EA0610B.90206@gmail.com> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-hackers@freebsd.org Subject: Re: Measuring memory footprint in C/C++ code on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 11:05:19 -0000 --3MwIy2ne0vdjdPXF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2011-Oct-20 19:57:31 +0200, Razmig K wrote: > I'd like to measure the memory footprint in C/C++ code for a=20 >program running under FreeBSD and Linux in terms of total process size=20 >including heap objects. Due to execution length, I'd like to avoid the=20 >use of valgrind. It's not clear whether the program is attempting to determine it's own (or a child's) memory footprint, or that of an arbitrary process. In the former case, getrusage() is the obvious choice. This as a portable interface. If you want to examine arbitrary processes, the best interface on FreeBSD would be kvm_getprocs(3). BTW, since you mention heap objects, I presume you are aware that malloc() uses mmap(), rather than sbrk() to obtain memory. --=20 Peter Jeremy --3MwIy2ne0vdjdPXF Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk6hMN0ACgkQ/opHv/APuIeatQCglXjkBVAyxZ1bqGxU9gMHLthX 7noAoL4YBgGFaeg6b4HO8/SSpJI0AnHU =912H -----END PGP SIGNATURE----- --3MwIy2ne0vdjdPXF-- From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 21 12:08:53 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F141106564A for ; Fri, 21 Oct 2011 12:08:53 +0000 (UTC) (envelope-from freebsd-hackers@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id DCADB8FC0C for ; Fri, 21 Oct 2011 12:08:52 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RHDu1-0001iR-JT for freebsd-hackers@freebsd.org; Fri, 21 Oct 2011 14:08:45 +0200 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 21 Oct 2011 14:08:45 +0200 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 21 Oct 2011 14:08:45 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-hackers@freebsd.org From: Ivan Voras Date: Fri, 21 Oct 2011 14:08:29 +0200 Lines: 61 Message-ID: References: <4EA0610B.90206@gmail.com> <20111021084413.GA46039@server.vk2pj.dyndns.org> <4EA1471E.9050501@gmail.com> <4EA15004.50308@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig75685E8576A963ABF750171C" X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0.1) Gecko/20111004 Thunderbird/7.0.1 In-Reply-To: <4EA15004.50308@gmail.com> X-Enigmail-Version: 1.1.2 Subject: Re: Measuring memory footprint in C/C++ code on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 12:08:53 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig75685E8576A963ABF750171C Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 21/10/2011 12:57, Razmig K wrote: > Le 21.10.2011 12:26, Ivan Voras a =C3=A9crit : >> Well, do you know that SIZE in top is virtual memory size, not residen= t >> size (which is the "RES" column)? You can allocate whatever you want >> from virtual memory, it is not "used" until it's touched. >=20 > Yes, I do. So do you suggest using RES as a better indicator of memory > footprint? Almost certainly yes. Measuring virtual memory is significantly less important for real-world loads. Some of this is very nicely described here: https://www.varnish-cache.org/trac/wiki/ArchitectNotes . > The program in question processes large 3D images via vtk, and I'd like= > to measure its memory usgae with different parameter configurations as > the maximum amount of memory acquired during execution. Since SIZE ofte= n > happens to be larger than RES, and increase more during execution, I > thought of using it as an indicator of memory footprint. No; the difference between SIZE and RES is "slack space" - allocated but untouched virtual memory, which is *NOT PRESENT IN RAM*. You can verify this yourself: make a small C program and allocate twice the physical memory (+swap) you have on the machine (try terabytes on a 64-bit machine), and it will succeed. If you look at this program in top, it should (barring some optimizations) show you that SIZE is huge, but RES is a couple of MB, basically like you didn't allocate anything at all. Now, it is a whole other thing if you try to actually *use* this memory you've allocated. Here's a random link on the topic from Google: http://opsmonkey.blogspot.com/2007/01/linux-memory-overcommit.html . Unfortunately, the phrase "memory overcommit" has been hijacked by the virtualization environment to mean the same thing but relating to the memory in virtual machines. --------------enig75685E8576A963ABF750171C Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk6hYL0ACgkQldnAQVacBch22QCg38zjUUahKydX8V5IFbeFXcDB leMAniWcI5UM+w1YoZFlpqu8fstCp93v =SRBe -----END PGP SIGNATURE----- --------------enig75685E8576A963ABF750171C-- From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 21 15:34:27 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 807CB106566C for ; Fri, 21 Oct 2011 15:34:27 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [89.206.35.99]) by mx1.freebsd.org (Postfix) with ESMTP id E5AF78FC13 for ; Fri, 21 Oct 2011 15:34:26 +0000 (UTC) Received: from wojtek.tensor.gdynia.pl (localhost [127.0.0.1]) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4) with ESMTP id p9LFYPAh013328; Fri, 21 Oct 2011 17:34:25 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.5/8.14.4/Submit) with ESMTP id p9LFYOsI013325; Fri, 21 Oct 2011 17:34:24 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Fri, 21 Oct 2011 17:34:24 +0200 (CEST) From: Wojciech Puchar To: Ivan Voras In-Reply-To: Message-ID: References: <4EA0610B.90206@gmail.com> <20111021084413.GA46039@server.vk2pj.dyndns.org> <4EA1471E.9050501@gmail.com> <4EA15004.50308@gmail.com> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (wojtek.tensor.gdynia.pl [127.0.0.1]); Fri, 21 Oct 2011 17:34:25 +0200 (CEST) Cc: freebsd-hackers@freebsd.org Subject: Re: Measuring memory footprint in C/C++ code on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 15:34:27 -0000 >> footprint? > > Almost certainly yes. Measuring virtual memory is significantly less > important for real-world loads. Some of this is very nicely described > here: https://www.varnish-cache.org/trac/wiki/ArchitectNotes . definitely. just run top and compare RES and SIZE fields. extreme example: #include int blah[1000000000]; main(){sleep(1000);} run it and see this in top 13317 wojtek 1 45 0 3817M 684K nanslp 0 0:00 0.00% 1 From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 21 16:15:08 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22AB2106564A for ; Fri, 21 Oct 2011 16:15:08 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email2.allantgroup.com (email2.emsphone.com [199.67.51.116]) by mx1.freebsd.org (Postfix) with ESMTP id B96878FC0A for ; Fri, 21 Oct 2011 16:15:07 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email2.allantgroup.com (8.14.4/8.14.4) with ESMTP id p9LFtwOh050885 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 21 Oct 2011 10:55:58 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.5/8.14.5) with ESMTP id p9LFtwMf077906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 21 Oct 2011 10:55:58 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.5/8.14.5/Submit) id p9LFtvXf077899; Fri, 21 Oct 2011 10:55:57 -0500 (CDT) (envelope-from dan) Date: Fri, 21 Oct 2011 10:55:57 -0500 From: Dan Nelson To: Razmig K Message-ID: <20111021155557.GC93709@dan.emsphone.com> References: <4EA0610B.90206@gmail.com> <20111021084413.GA46039@server.vk2pj.dyndns.org> <4EA1471E.9050501@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4EA1471E.9050501@gmail.com> X-OS: FreeBSD 8.2-STABLE User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.97.2 at email2.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.6 (email2.allantgroup.com [199.67.51.78]); Fri, 21 Oct 2011 10:55:58 -0500 (CDT) X-Scanned-By: MIMEDefang 2.68 on 199.67.51.78 Cc: freebsd-hackers@freebsd.org Subject: Re: Measuring memory footprint in C/C++ code on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 16:15:08 -0000 In the last episode (Oct 21), Razmig K said: > Le 21.10.2011 10:44, Peter Jeremy a écrit : > > On 2011-Oct-20 19:57:31 +0200, Razmig K wrote: > > It's not clear whether the program is attempting to determine it's own > > (or a child's) memory footprint, or that of an arbitrary process. In > > the former case, getrusage() is the obvious choice. This as a portable > > interface. > > The program has to determine its own memory footprint. It has no children. > > > If you want to examine arbitrary processes, the best interface on > > FreeBSD would be kvm_getprocs(3). > > > > BTW, since you mention heap objects, I presume you are aware that > > malloc() uses mmap(), rather than sbrk() to obtain memory. > > No I wasn't aware of that. > > In few words, the program needs to obtain and report information > reported by the SIZE column of top, since it is going to be run many > times, and it is impractical to watch top for this purpose. top also uses kvm_getprocs, so you can use that as a template (see the manpage and source at usr/src/usr.bin/top/machine.c). If you call it with the KERN_PROC_PID flag, you can get the stats for a single processs by pid. If you want even more detail, you can look at the source to the procstat command, which uses some other calls to dump the vm map of processes. -- Dan Nelson dnelson@allantgroup.com From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 21 22:39:34 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59905106566B for ; Fri, 21 Oct 2011 22:39:34 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 055508FC15 for ; Fri, 21 Oct 2011 22:39:33 +0000 (UTC) Received: by qyg14 with SMTP id 14so5164710qyg.13 for ; Fri, 21 Oct 2011 15:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; bh=ANBF92++NfU0ruhc3b1mkU//u/VCuNTrvy0bnMwf0TA=; b=ho5wYSnQGLF/EQjnuYUs5r3i9vXDJmP29FnKBmOrJtHVsyNOPxtXeTaSMjYBYxQyiz TLrag7O4zrDBrK6EL1Wz1AyGNT4KgoKROTJ3GK2F3mBCP9vRbviPLWjNDfCPYFXWSbqe mNJl7KQ0thzeKREiHOBJdRbiVxr6BOewg8R74= Received: by 10.229.44.206 with SMTP id b14mr3470356qcf.175.1319236773381; Fri, 21 Oct 2011 15:39:33 -0700 (PDT) Received: from kan.dnsalias.net (c-24-63-226-98.hsd1.ma.comcast.net. [24.63.226.98]) by mx.google.com with ESMTPS id hf9sm16702834qab.16.2011.10.21.15.39.31 (version=SSLv3 cipher=OTHER); Fri, 21 Oct 2011 15:39:32 -0700 (PDT) Date: Fri, 21 Oct 2011 18:39:24 -0400 From: Alexander Kabaev To: Garrett Cooper Message-ID: <20111021183924.2158d226@kan.dnsalias.net> In-Reply-To: References: <20111020082234.GA4568@britannica.bec.de> <4EA00DEF.3030905@FreeBSD.org> <20111020190553.6bf95790@kan.dnsalias.net> <20111020192653.6425f018@kan.dnsalias.net> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.6; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/28q.UctdIFDz6cjc75RVw0."; protocol="application/pgp-signature" Cc: Wojciech Puchar , freebsd-hackers Subject: Re: .eh_frame, .eh_frame_hdr - how to remove that trash X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 22:39:34 -0000 --Sig_/28q.UctdIFDz6cjc75RVw0. Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 21 Oct 2011 00:54:32 -0700 Garrett Cooper wrote: > On Fri, Oct 21, 2011 at 12:51 AM, Wojciech Puchar > wrote: > >> on entry into each function, which is different from usual x86 > >> convention. > >> Asynchronous unwind info (yeah, same stuff you keep referring to as > >> crap), is the only way you can debug your program or get anything > >> remotely close to usable backtrace, by default. > > > > i understand but i DO NOT called compiler with -g option which > > clearly means that i do not want to debug isn't it? >=20 > It seems like a binutils bug (or somewhere in that immediate > neighborhood) because all debugging related sections should be > stripped out by strip including unwind, correct? > Thanks, > -Garrett NO. Unwind info is a part of the ABI, and its relationship to debug flags as well as to wishes of the OP is very remote. --=20 Alexander Kabaev --Sig_/28q.UctdIFDz6cjc75RVw0. Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iD8DBQFOofSiQ6z1jMm+XZYRArF8AJ9JiBYRo8W883pcxREti/Q9ftR/3ACgpiXs nNAWR+Lrpre2JkfGfTIgDSc= =+uf6 -----END PGP SIGNATURE----- --Sig_/28q.UctdIFDz6cjc75RVw0.--