From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27294 invoked by alias); 23 Sep 2014 07:37:16 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 27284 invoked by uid 89); 23 Sep 2014 07:37:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: collab.rosalab.ru Received: from collab.rosalab.ru (HELO collab.rosalab.ru) (195.19.76.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 23 Sep 2014 07:37:14 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by collab.rosalab.ru (Postfix) with ESMTP id 80CE729C074; Tue, 23 Sep 2014 11:37:07 +0400 (MSK) Received: from collab.rosalab.ru ([127.0.0.1]) by localhost (collab.rosalab.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GfZdy0fIjiQ4; Tue, 23 Sep 2014 11:37:02 +0400 (MSK) Received: from [10.168.1.216] (unknown [217.199.216.178]) by collab.rosalab.ru (Postfix) with ESMTPSA id 76E9D29C06C; Tue, 23 Sep 2014 11:37:02 +0400 (MSK) Message-ID: <54212321.3020709@rosalab.ru> Date: Tue, 23 Sep 2014 07:37:00 -0000 From: Eugene Shatokhin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: gcc-help@gcc.gnu.org CC: Nikita Komarov Subject: Finding positions of the instructions Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg00126.txt.bz2 Hi, In one of our projects, a GCC plugin implements a pass (operates on GIMPLE repr.) and selects some interesting statements in the code being compiled, mainly some of the memory accesses. Everything is done on Linux, i586 and x86_64, GCC 4.9. I'd like to find the positions of the machine instructions corresponding to these selected statements in the compiled binaries (or to detect that the compiler has eliminated those statements). + would do. Is it possible to do it via a GCC plugin? Or, perhaps, saving the source code locations for the statements of interest during the GIMPLE pass and then using debug info (with libdw or something) to get the positions of the instructions is the best bet? Or, maybe, there is some other way to find the instructions corresponding to these statements? Any ideas are appreciated. Regards, Eugene -- Eugene Shatokhin, ROSA www.rosalab.com