From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 107012 invoked by alias); 22 Jan 2019 11:21:19 -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 106997 invoked by uid 89); 22 Jan 2019 11:21:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=for, for=c2, forgotten, gdbjit.cpp?= X-HELO: mail-lf1-f43.google.com Received: from mail-lf1-f43.google.com (HELO mail-lf1-f43.google.com) (209.85.167.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 Jan 2019 11:21:13 +0000 Received: by mail-lf1-f43.google.com with SMTP id n18so17779434lfh.6 for ; Tue, 22 Jan 2019 03:21:13 -0800 (PST) MIME-Version: 1.0 References: <20190118115004.1a51eefc@archvm> <20190121145310.36158a70@archvm> In-Reply-To: <20190121145310.36158a70@archvm> From: Tony Simpson Date: Tue, 22 Jan 2019 11:21:00 -0000 Message-ID: Subject: Re: jit interface and jit reader To: Frank Tetzel Cc: gdb@sourceware.org Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-01/txt/msg00022.txt.bz2 Hi Frank, I think I ran into the same problem a couple of years ago. I fixed my problem here https://github.com/tonysimpson/binutils-gdb/commits/jit-interface-fixes. I've forgotten the details but I remember I got it working with my patch - here is the commit message for 3c0e5d45f727d5ef98b681103954820c8fbbd700 Fixes: * Named blocks not appearing as functions - can't break on functions; * Pending breakpoints on JIT'd code not being resolved; * GDB goes into an infinit loop with more than one JIT block in a symtab; * Unwinder function not being called. Hope this helps. Best Regards, Tony On Mon, 21 Jan 2019 at 13:53, Frank Tetzel wrote: > > 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 >