From owner-svn-src-head@FreeBSD.ORG Wed Dec 26 05:20:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 30143203; Wed, 26 Dec 2012 05:20:16 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-qa0-f45.google.com (mail-qa0-f45.google.com [209.85.216.45]) by mx1.freebsd.org (Postfix) with ESMTP id 9E02F8FC0A; Wed, 26 Dec 2012 05:20:15 +0000 (UTC) Received: by mail-qa0-f45.google.com with SMTP id j15so8222291qaq.4 for ; Tue, 25 Dec 2012 21:20:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=WfY13Nw3r+HyIOX4653B8OH/bNyxbJVy0urWg238IJc=; b=Er41QKWrtjkxXJEbDz2Kb/ZwfrV70FgA1e/jv/nd+P2BOjbH3C/gqrDJJHxDJlm800 Pqgf+gbAhXYhOqRxIa+HfG2xq5il+i5fyKDHOeh98fffB1BqQMg4VbGzJ8eTZ0SPuk79 MyjKj1PkyGwnP1j3p/iEqkopuY0KlG3FxeozD+DW+/e2pPcV1noapFQrbKxk6EbfxgBH 6QOXREY4x2dIhe6ax6eMPklmezK2AOYtkEtB1LZnios82WbrxF7gD0ejTtOOn0MyTS/j KazcP7Q0tcd96mlEnoqVvlaUtKJsZp7FvtsPpr84bN/4/Z7gkUcTsysI0lb1WYIHxpfF CwUQ== MIME-Version: 1.0 Received: by 10.224.60.12 with SMTP id n12mr12635412qah.23.1356499209264; Tue, 25 Dec 2012 21:20:09 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.229.78.96 with HTTP; Tue, 25 Dec 2012 21:20:09 -0800 (PST) In-Reply-To: <201212260511.qBQ5BmOs001404@svn.freebsd.org> References: <201212260511.qBQ5BmOs001404@svn.freebsd.org> Date: Wed, 26 Dec 2012 08:20:09 +0300 X-Google-Sender-Auth: JcNjidSshA43Yf1LGKSxr-9EQ-0 Message-ID: Subject: Re: svn commit: r244692 - head/lib/libproc/test/t1-bkpt From: Sergey Kandaurov To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Dec 2012 05:20:16 -0000 On 26 December 2012 09:11, Sergey Kandaurov wrote: > Author: pluknet > Date: Wed Dec 26 05:11:48 2012 > New Revision: 244692 > URL: http://svnweb.freebsd.org/changeset/base/244692 > > Log: > Fix libproc test case to work with clang premature optimization > observed with -O2 (used by default). > Avoid function inlining for t1_bkpt_t on which we set a breakpoint. > Otherwise the address of the function is never called thus the > breakpoint never triggers. > > Reported by: zont > Reviewed by: rpaulo > > Modified: > head/lib/libproc/test/t1-bkpt/t1-bkpt.c > > Modified: head/lib/libproc/test/t1-bkpt/t1-bkpt.c > ============================================================================== > --- head/lib/libproc/test/t1-bkpt/t1-bkpt.c Tue Dec 25 23:34:20 2012 (r244691) > +++ head/lib/libproc/test/t1-bkpt/t1-bkpt.c Wed Dec 26 05:11:48 2012 (r244692) > @@ -36,7 +36,7 @@ > #include > #include > > -int > +int __noinline > t1_bkpt_t() > { > printf("TEST OK\n"); This can be demonstrated with the generated code diff: 0000000000400b20
: 400b20: 55 push %rbp 400b21: 48 89 e5 mov %rsp,%rbp 400b24: 48 8b 3e mov (%rsi),%rdi - 400b27: be a9 0b 40 00 mov $0x400ba9,%esi + 400b27: be a0 0b 40 00 mov $0x400ba0,%esi 400b2c: e8 bb fc ff ff callq 4007ec 400b31: 85 c0 test %eax,%eax 400b33: 74 07 je 400b3c 400b35: e8 f6 fe ff ff callq 400a30 - 400b3a: eb 05 jmp 400b41 - 400b3c: e8 df fe ff ff callq 400a20 - 400b41: 31 c0 xor %eax,%eax - 400b43: 5d pop %rbp - 400b44: c3 retq - 400b45: 90 nop - 400b46: 90 nop - 400b47: 90 nop - 400b48: 90 nop - 400b49: 90 nop + 400b3a: eb 0a jmp 400b46 + 400b3c: bf c3 0b 40 00 mov $0x400bc3,%edi + 400b41: e8 b6 fc ff ff callq 4007fc + 400b46: 31 c0 xor %eax,%eax + 400b48: 5d pop %rbp + 400b49: c3 retq 400b4a: 90 nop 400b4b: 90 nop 400b4c: 90 nop 400b4d: 90 nop 400b4e: 90 nop 400b4f: 90 nop -- wbr, pluknet