From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3066 invoked by alias); 5 Jan 2011 23:28:10 -0000 Received: (qmail 3058 invoked by uid 22791); 5 Jan 2011 23:28:10 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_YM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 05 Jan 2011 23:28:04 +0000 Received: (qmail 2271 invoked from network); 5 Jan 2011 23:28:02 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 5 Jan 2011 23:28:02 -0000 From: Pedro Alves To: Paul Pluzhnikov Subject: Re: [patch] Add "debug jit" for easier tracing of JIT support internals Date: Wed, 05 Jan 2011 23:28:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.33-29-realtime; KDE/4.4.5; x86_64; ; ) Cc: gdb-patches@sourceware.org, Doug Evans References: <20110105193621.A8CBF190B3A@elbrus2.mtv.corp.google.com> <201101052257.30806.pedro@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201101052328.00646.pedro@codesourcery.com> X-IsSubscribed: yes 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 X-SW-Source: 2011-01/txt/msg00100.txt.bz2 On Wednesday 05 January 2011 23:15:31, Paul Pluzhnikov wrote: > Right. It's actually specified as uint64_t in jit.h, not size_t ... > > > while 'size_t' is about sizes of objects > > on the host. E.g., on a 32-bit GDB (cross) debugging a 64-bit > > inferior, size_t will usually be a 32-bit type. I think it'd be > > better to make that a ULONGEST throughout (and then use phex > > or pulongest) > > Since this interface is frozen, and ULONGEST isn't available to clients, > I'll just cast symfile_size to ULONGEST and print it with pulongest. That's better than %z, but I don't see why making that uint64_t be a ULONGEST would be a problem. The definition of: struct jit_code_entry { CORE_ADDR next_entry; CORE_ADDR prev_entry; CORE_ADDR symfile_addr; uint64_t symfile_size; }; in jit.h, is not included by clients. Clients should define it like so, as per the manual: struct jit_code_entry { struct jit_code_entry *next_entry; struct jit_code_entry *prev_entry; const char *symfile_addr; uint64_t symfile_size; }; GDB reads this out of the inferior like so: /* Fix the endianness to match the host. */ ptr_type = builtin_type (gdbarch)->builtin_data_ptr; code_entry->next_entry = extract_typed_address (&entry_buf[0], ptr_type); code_entry->prev_entry = extract_typed_address (&entry_buf[ptr_size], ptr_type); code_entry->symfile_addr = extract_typed_address (&entry_buf[2 * ptr_size], ptr_type); code_entry->symfile_size = extract_unsigned_integer (&entry_buf[3 * ptr_size], 8, byte_order); And, extract_unsigned_integer returns a ULONGEST... -- Pedro Alves