From: Michael Snyder <msnyder@redhat.com>
To: Michal Ludvig <mludvig@suse.cz>
Cc: Mark Kettenis <kettenis@chello.nl>,
GDB Patches <gdb-patches@sources.redhat.com>
Subject: Re: [RFA/i386newframe] info cfi command
Date: Tue, 03 Jun 2003 00:39:00 -0000 [thread overview]
Message-ID: <3EDBEE44.47AF5D05@redhat.com> (raw)
In-Reply-To: <3ED60F2A.9060108@suse.cz>
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 <mludvig@suse.cz>
>
> * 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 <stddef.h>
> @@ -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);
> }
prev parent reply other threads:[~2003-06-03 0:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-29 13:46 Michal Ludvig
2003-05-29 14:16 ` Eli Zaretskii
2003-05-29 14:56 ` Michal Ludvig
2003-05-29 16:29 ` Mark Kettenis
2003-05-29 18:14 ` Andrew Cagney
2003-05-30 12:33 ` Michal Ludvig
2003-05-31 16:35 ` Mark Kettenis
2003-05-31 16:47 ` Andrew Cagney
2003-05-31 16:49 ` Michal Ludvig
2003-06-01 16:24 ` Eli Zaretskii
2003-06-03 0:39 ` Michael Snyder [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3EDBEE44.47AF5D05@redhat.com \
--to=msnyder@redhat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=kettenis@chello.nl \
--cc=mludvig@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox