From: Tom Tromey <tromey@redhat.com>
To: Sanjoy Das <sanjoy@playingwithpointers.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 4/7] Use the loaded reader.
Date: Mon, 15 Aug 2011 20:21:00 -0000 [thread overview]
Message-ID: <m3y5yuctp9.fsf@fleche.redhat.com> (raw)
In-Reply-To: <1312903509-25132-5-git-send-email-sanjoy@playingwithpointers.com> (Sanjoy Das's message of "Tue, 9 Aug 2011 20:55:06 +0530")
>>>>> "Sanjoy" == Sanjoy Das <sanjoy@playingwithpointers.com> writes:
Sanjoy> Invoke the loaded JIT debug info reader to parse the registered symbol
Sanjoy> files.
Thanks.
Sanjoy> +/* Remember a mapping from entry_addr to objfile. */
Sanjoy> +static void
Sanjoy> +add_objfile_entry (struct objfile *objfile, CORE_ADDR entry)
Sanjoy> +{
Sanjoy> + CORE_ADDR *entry_addr_ptr;
Sanjoy> +
Sanjoy> + entry_addr_ptr = xmalloc (sizeof (CORE_ADDR));
Sanjoy> + *entry_addr_ptr = entry;
Sanjoy> + set_objfile_data (objfile, jit_objfile_data, entry_addr_ptr);
Sanjoy> +}
Sanjoy> +/* Returns true if the block corrensponding to old should be placed
Typo, "corresponding".
Sanjoy> +static struct gdb_block *
Sanjoy> +jit_block_open_impl (struct gdb_symbol_callbacks *cb, struct gdb_symtab *symtab,
This line is too long.
Every new function should have some kind of introductory comment. There
should be a blank line between the comment and the start of the
function.
Sanjoy> static void
Sanjoy> -jit_register_code (struct gdbarch *gdbarch,
Sanjoy> - CORE_ADDR entry_addr, struct jit_code_entry *code_entry)
Sanjoy> +jit_symtab_line_mapping_add_impl (struct gdb_symbol_callbacks *cb,
Sanjoy> + struct gdb_symtab *stab, int nlines,
Sanjoy> + struct gdb_line_mapping *map)
Sanjoy> +{
Sanjoy> + int i;
Sanjoy> + if (!nlines)
Blank line between declarations and code.
For safety this check should probably be 'if (nlines < 1)'.
Sanjoy> + stab->linetable = xmalloc (sizeof (struct linetable) + (nlines - 1) *
Sanjoy> + sizeof (struct linetable_entry));
Break before "*", not after it. This is a GNU style thing.
Personally I'd prefer a break before the "+" instead.
Sanjoy> +static void
Sanjoy> +jit_symtab_close_impl (struct gdb_symbol_callbacks *cb, struct gdb_symtab *stab)
Line too long.
Sanjoy> + int actual_nblocks = FIRST_LOCAL_BLOCK + stab->nblocks, i, blockvector_size;
Line too long.
Sanjoy> + int size = (stab->linetable->nitems - 1) *
Sanjoy> + sizeof (struct linetable_entry) + sizeof (struct linetable);
Line breaks before operators.
According to GNU style you have to parenthesize the RHS here, and
further indent the second line.
Sanjoy> + blockvector_size = (sizeof (struct blockvector) +
Sanjoy> + (actual_nblocks - 1) * sizeof (struct block *));
... like this :-)
Sanjoy> + block_name->symtab = symtab;
You can use SYMBOL_SYMTAB here.
Sanjoy> + block_name->ginfo.name = obstack_alloc (&objfile->objfile_obstack, 1 +
Sanjoy> + strlen (gdb_block_iter->name));
I think it needs to be strlen() + 1 -- but you can just use obsavestring
instead.
Sanjoy> +/* Convert OBJ to a proper objfile. */
Sanjoy> +static void
Sanjoy> +jit_object_close_impl (struct gdb_symbol_callbacks *cb, struct gdb_object *obj)
Line too long.
Sanjoy> + objfile->msymbols = obstack_alloc (&objfile->objfile_obstack,
Sanjoy> + sizeof (struct minimal_symbol));
Sanjoy> + objfile->msymbols[0].ginfo.name = NULL;
Sanjoy> + objfile->msymbols[0].ginfo.value.address = 0;
A little surprising maybe, but I guess it is ok.
Sanjoy> + objfile->name = xstrdup ("JIT");
You have to xfree the old name first.
Sanjoy> static void
Sanjoy> jit_unregister_code (struct objfile *objfile)
Sanjoy> {
Sanjoy> + xfree (objfile_data (objfile, jit_objfile_data));
Sanjoy> free_objfile (objfile);
Sanjoy> }
I think a better fix for this problem would be to change the
initialization of jit_objfile_data to use register_objfile_data_with_cleanup.
Tom
next prev parent reply other threads:[~2011-08-15 20:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-09 15:21 [PATCH] JIT debug info Reader Sanjoy Das
2011-08-09 15:21 ` [PATCH 1/7] Introduce header (jit-reader.h.in) and modify build system Sanjoy Das
2011-08-09 15:40 ` Eli Zaretskii
2011-08-09 15:43 ` Sanjoy Das
2011-08-09 15:53 ` Eli Zaretskii
2011-08-20 17:17 ` Jan Kratochvil
2011-08-20 17:31 ` Eli Zaretskii
2011-08-20 17:42 ` Jan Kratochvil
2011-08-20 17:52 ` Eli Zaretskii
2011-08-10 20:57 ` Tom Tromey
2011-08-09 15:21 ` [PATCH 4/7] Use the loaded reader Sanjoy Das
2011-08-15 20:21 ` Tom Tromey [this message]
2011-08-09 15:21 ` [PATCH 3/7] New commands for loading and unloading a reader Sanjoy Das
2011-08-12 20:58 ` Tom Tromey
2011-08-09 15:21 ` [PATCH 7/7] Add documentation Sanjoy Das
2011-08-09 15:51 ` Eli Zaretskii
2011-08-09 15:21 ` [PATCH 5/7] Add a proxy unwinder Sanjoy Das
2011-08-15 20:38 ` Tom Tromey
2011-08-20 6:26 ` Sanjoy Das
2011-08-09 15:21 ` [PATCH 2/7] Add platform agnostic dynamic loading code Sanjoy Das
2011-08-10 21:01 ` Tom Tromey
2011-08-09 15:21 ` [PATCH 6/7] Register the proxy unwinder Sanjoy Das
2011-08-12 21:07 ` Tom Tromey
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=m3y5yuctp9.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=sanjoy@playingwithpointers.com \
/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