From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11487 invoked by alias); 3 Jun 2003 00:39:35 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 11480 invoked from network); 3 Jun 2003 00:39:35 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 3 Jun 2003 00:39:35 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h530dYH02014 for ; Mon, 2 Jun 2003 20:39:35 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h530dXT11230; Mon, 2 Jun 2003 20:39:33 -0400 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id h530dW008185; Mon, 2 Jun 2003 17:39:32 -0700 Message-ID: <3EDBEE44.47AF5D05@redhat.com> Date: Tue, 03 Jun 2003 00:39:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Accept-Language: en MIME-Version: 1.0 To: Michal Ludvig CC: Mark Kettenis , GDB Patches Subject: Re: [RFA/i386newframe] info cfi command References: <3ED60F2A.9060108@suse.cz> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2003-06/txt/msg00100.txt.bz2 Michal Ludvig wrote: > > Hi, > this patch adds 'info cfi' command which is to be used for examining > debug info. For now it only prints the instructions in a hex-form, but > I'll make a resolver to nice strings later. > > It doesn't change anything except that it adds a new command. > > Can I commit it? > > Michal Ludvig May I request that the command be more self-documenting? At the least, 'help' should tell you what a "CFI" is... > -- > * SuSE CR, s.r.o * mludvig@suse.cz > * (+420) 296.545.373 * http://www.suse.cz > > ------------------------------------------------------------------------------- > 2003-05-29 Michal Ludvig > > * dwarf-frame.c (cfi_info, _initialize_dwarf_frame): New > functions. > > Index: dwarf-frame.c > =================================================================== > RCS file: /cvs/src/src/gdb/Attic/dwarf-frame.c,v > retrieving revision 1.1.2.6 > diff -u -p -r1.1.2.6 dwarf-frame.c > --- dwarf-frame.c 23 May 2003 20:18:32 -0000 1.1.2.6 > +++ dwarf-frame.c 29 May 2003 13:28:08 -0000 > @@ -32,6 +32,8 @@ > #include "symtab.h" > #include "objfiles.h" > #include "regcache.h" > +#include "gdbcmd.h" > +#include "value.h" > > #include "gdb_assert.h" > #include > @@ -1232,4 +1234,83 @@ dwarf2_build_frame_info (struct objfile > while (frame_ptr < unit.dwarf_frame_buffer + unit.dwarf_frame_size) > frame_ptr = decode_frame_entry (&unit, frame_ptr, 0); > } > +} > + > +/* Interactive interface. */ > + > +static void > +cfi_info (char *arg, int from_tty) > +{ > + CORE_ADDR addr, low, high; > + unsigned long data_length; > + struct dwarf2_fde *fde; > + char *name; > + int i; > + > + if (! arg) > + error_no_arg ("address"); > + > + addr = parse_and_eval_address (arg); > + printf_filtered ("Searching CFI for address %p...\n", (void*)addr); > + > + if (find_pc_partial_function (addr, &name, &low, &high)) > + printf_filtered ("\tBelongs to function '%s' (%p..%p).\n", > + name, (void*)low, (void*)high); > + > + fde = dwarf2_frame_find_fde (&addr); > + if (! fde) > + { > + printf_filtered ("\tCFI entry not found.\n"); > + return; > + } > + > + /* Print out CIE. */ > + data_length = fde->cie->end - fde->cie->initial_instructions; > + printf_filtered ("CIE:\n"); > + printf_filtered ("\toffset = %llx\n" > + "\tcode_align = %llu, data_align = %lld, ra_column = 0x%llx\n" > + "\tdata_length = %lu, data: \n\t", > + fde->cie->cie_pointer, > + fde->cie->code_alignment_factor, > + fde->cie->data_alignment_factor, > + fde->cie->return_address_register, > + data_length); > + > + for (i = 0; i < data_length; i++) > + { > + printf_filtered ("0x%02x ", fde->cie->initial_instructions[i] & 0xff); > + if ((i + 1) % 8 == 0) > + printf_filtered ("\n\t"); > + else if ((i + 1) % 4 == 0) > + printf_filtered (" "); > + } > + if (i % 8) > + printf_filtered ("\n"); > + > + /* Print out FDE. */ > + data_length = fde->end - fde->instructions; > + printf_filtered ("FDE:\n"); > + printf_filtered ("\tlocation = 0x%llx..0x%llx (size = %lld)\n" > + "\tdata_length = %lu, data: \n\t", > + fde->initial_location, > + (fde->initial_location + fde->address_range), > + fde->address_range, data_length); > + for (i = 0; i < data_length; i++) > + { > + printf_filtered ("0x%02x ", fde->instructions[i] & 0xff); > + if ((i + 1) % 8 == 0) > + printf_filtered ("\n%s", i + 1 < data_length ? "\t" : ""); > + else if ((i + 1) % 4 == 0) > + printf_filtered (" "); > + } > + if (i % 8) > + printf_filtered ("\n"); > +} > + > +void > +_initialize_dwarf_frame (void) > +{ > + add_info ("cfi", cfi_info, "Find and print CFI for a given address."); > + add_info_alias ("fde", "cfi", 1); > + add_info_alias ("cie", "cfi", 1); > }