From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15012 invoked by alias); 16 May 2014 15:26:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 14984 invoked by uid 89); 16 May 2014 15:26:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 May 2014 15:26:40 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4GFQdII019049 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 16 May 2014 11:26:39 -0400 Received: from barimba.redhat.com (ovpn-113-182.phx2.redhat.com [10.3.113.182]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4GFQcV2006849 for ; Fri, 16 May 2014 11:26:39 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH 00/14] let gdb reuse gcc's C compiler Date: Fri, 16 May 2014 15:26:00 -0000 Message-Id: <1400253995-12333-1-git-send-email-tromey@redhat.com> X-SW-Source: 2014-05/txt/msg00287.txt.bz2 Hi! This patch series is half of a project to let gdb reuse gcc (which half depends on which list you are seeing this on), so that users can compile small snippets of code and evaluate them in the current context of the inferior. This first series implements this idea for C. A user can compile a code snippet and it will be inserted into the inferior and evaluated. Declarations needed by the snippet are supplied by gdb, and there is a bit of magic so that the snippets can refer to local variables in the current frame. The new command allows for arbitrary code to be inserted -- not just expressions. For example: (gdb) compile code int i; for (i = 0; i < 3; ++i) printf ("#%d\n", i) #0 #1 #2 This series supplies a gcc plugin to do most of the work, so that any gcc crashes -- seen during development due to translation bugs -- do not also crash gdb. The interface between gdb and gcc is defined by a few files added to include/. There is a new shared library which gdb loads in order to communicate with the gcc plugin. This library communicates with the gcc plugin using a simple, ad-hoc RPC mechanism. This shared library exports a single public function which is used to instantiate any needed objects. This makes it simple to version the API and avoid undue synchronization between gcc and gdb. We think the plugin is best suited to be put into the gcc repository because it is coupled more tightly to gcc than to gdb. To try it out, just build gcc and gdb with the patches applied. Then set your PATH and LD_LIBRARY_PATH to point to the right subdirectories of the new gcc install directory. In later series we plan to extend this functionality; either on the gcc side, say by writing a similar plugin for C++; or on the gdb side, say by making it possible to compile breakpoint conditions. However, we haven't yet decided exactly which future projects we will tackle or in what order.