From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29887 invoked by alias); 24 May 2012 11:04:15 -0000 Received: (qmail 29876 invoked by uid 22791); 24 May 2012 11:04:14 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-lb0-f169.google.com (HELO mail-lb0-f169.google.com) (209.85.217.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 May 2012 11:04:00 +0000 Received: by lbjn8 with SMTP id n8so7235080lbj.0 for ; Thu, 24 May 2012 04:03:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :x-gm-message-state; bh=JWFvhj9Tb/f6TMu0Mee8G0jioxEP1bVikO4SqpAsIz0=; b=ipFEbfB9SgPLg2KsnauQncbfF618VPe8CFNnXtNSMyJm+Ap5MZFd1G9P7HuUAtxVU/ Td8VL//+5mPTcR1hBfwAbqhfyY6bEo/7xbfBcTMAXEIBKy9zgzuVQ+ITl7OXmPlVQSbY /a5OkkDNVMaAx7XGW1q0n5VoRNud1/6unwupGYbyHWLnVmSg3blGFuTeH9fvTEw7R1bd oJyNAubZIv428eNCvWbfVVPRhSQ28O3/W7VjyLRUAedH6kSOq9Lry2aYGOi/bGNE0A90 7f9HdXW64zdLQZ+E5XZgCNcq69KL4eq6jNdF/GZIwYmeA2WlsBWlqRaQaj4OPKwayzjo xA9w== MIME-Version: 1.0 Received: by 10.112.38.161 with SMTP id h1mr13534051lbk.85.1337857438895; Thu, 24 May 2012 04:03:58 -0700 (PDT) Received: by 10.152.131.10 with HTTP; Thu, 24 May 2012 04:03:58 -0700 (PDT) Date: Thu, 24 May 2012 11:04:00 -0000 Message-ID: Subject: Hotspot JVM GDBJIT plugin From: Kaushik Srenevasan To: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmoPtDE2ApOPbUQIozmninOgX1L2V+XUhmYgQvhzKKKtCYdDL72rt7Mqdgc5zfs4dcwU2Zj X-IsSubscribed: yes 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 X-SW-Source: 2012-05/txt/msg00121.txt.bz2 I've been working on a Hotspot JVM JIT plugin for GDB and noticed that there was some interest about this earlier [1]. I currently have mixed mode stack traces working [2] and plan to at least add file and line number support in the future. I'm writing to see if there is any interest in pulling the changes [3] I've had to make to GDB, to get this to work. I also intend to ping the OpenJDK folks to try to get the GDBJIT hooks into the official distribution. The first of these changes [3] is a simple fix to a crash while trying to display the return type of a JIT frame (say on 'finish'.) The second (frame based symbol handler) is a feature added to help GDB understand frames created by Hotspot's "template" interpreter. Hotspot generates expansions for bytecodes from templates (once) into a buffer and uses jump tables to handle dispatch. The same code range thus corresponds to different functions, with the only differentiating factor being metadata in stack frames. Neither ELF symbol tables nor callbacks work in this case and hence the need for frame based symbol resolution. This adds an additional callback that the reader may choose to implement to return the name (file path or line number) of the function executing in the frame in question. GDB's stack walk code consults this handler if it can't find a symbol in its global symbol table. The JIT host inserts itself as a handler and simply forwards the call to the reader. Symbols are only ever created lazily; when the unwinder finds the frame on the stack. I also want to add support to display inlined frames which I can't imagine being realized without frame based handlers. [3] is only a rough implementation that I intend to complete based on feedback I get from this list. Thanks, -Kaushik [1] http://sources.redhat.com/ml/gdb/2012-02/msg00025.html [2] http://sysenter.org/~ks/gdb/gdb-jvm.png [3] https://github.com/kaushiks/GDB/commit/98d8b224c3f48639368e91f0a531394124596a2e