From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 112430 invoked by alias); 21 Jan 2019 13:53:25 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 112410 invoked by uid 89); 21 Jan 2019 13:53:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=1.8 required=5.0 tests=BAYES_50,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=HX-HELO:sk:mailout, Hx-spam-relays-external:sk:server-, H*RU:sk:server-, H*r:sk:server- X-HELO: mailout6.zih.tu-dresden.de Received: from mailout6.zih.tu-dresden.de (HELO mailout6.zih.tu-dresden.de) (141.30.67.75) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Jan 2019 13:53:23 +0000 Received: from mail.zih.tu-dresden.de ([141.76.14.4]) by mailout6.zih.tu-dresden.de with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84_2) (envelope-from ) id 1gla0t-0006GA-WD for gdb@sourceware.org; Mon, 21 Jan 2019 14:53:20 +0100 Received: from [155.56.40.47] (helo=archvm) by server-40.mailclusterdns.zih.tu-dresden.de with esmtpsa (TLSv1.2:AES256-SHA:256) (envelope-from ) id 1gla0t-0003hX-Pm for gdb@sourceware.org; Mon, 21 Jan 2019 14:53:19 +0100 Date: Mon, 21 Jan 2019 13:53:00 -0000 From: Frank Tetzel To: gdb@sourceware.org Subject: Re: jit interface and jit reader Message-ID: <20190121145310.36158a70@archvm> In-Reply-To: <20190118115004.1a51eefc@archvm> References: <20190118115004.1a51eefc@archvm> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TUD-Original-From: frank.tetzel@tu-dresden.de X-IsSubscribed: yes X-SW-Source: 2019-01/txt/msg00017.txt.bz2 > I have trouble getting GDB's jit interface to work. I'm trying to make > application using AsmJit [1] easier to debug by being able to break > when entering jitted code. As AsmJit is just an assembler returning a > function pointer to the generated code, I do not want to create an > object file for it. That is why I'm trying to use jit-reader, but the > symbol does not seem to show up in GDB and a pending breakpoint is > never hit. > > What am I doing wrong? I attached two files: gdbjit.cpp is talking to > GDB via the jit interface. gdbjit-reader.c is the jit reader for GDB > which I compile to a shared object and load in GDB with > jit-reader-load. > > It does not implement unwind and get_frame_id. Do I need these > functions? unwind is called sometimes. Is there a minimal example > somewhere which implements jit reader? > > [1] https://github.com/asmjit/asmjit I looked at GDB's source code a bit and found a minimal example in testsuite/gdb.base/jit{host.c,reader.c}. The problem is also visible there: I can follow the indirect call into the generated code. In TUI-mode, the instructions belonging to the function have the correct symbol+offset. backtrace shows the function name as well. But, I cannot set a breakpoint with the function name. Nor can I use the command disassemble, only the disassemble view in TUI works. How can I register the address range as a proper function? Best regards, Frank