Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: "'Mark Kettenis'" <mark.kettenis@xs4all.nl>
Cc: <pedro@codesourcery.com>, <drow@false.org>, <gdb-patches@sourceware.org>
Subject: RE: [PING2] : [RFC/RFA] PING: skip __main
Date: Fri, 30 May 2008 18:18:00 -0000	[thread overview]
Message-ID: <001901c8c256$06f8be00$14ea3a00$@u-strasbg.fr> (raw)
In-Reply-To: <200805301157.m4UBvOL5009408@brahms.sibelius.xs4all.nl>

Thanks for the fast reply.

> I'm afraid I think that skip_main_constructor_call is too long as a name.

  I am perfectly willing to use something shorter, 
the only problem is to find something that would still be 
of clear meaning.

   maybe
  skip_main_prologue
would be better?

> I'd also appreciate it if you could seperate local variable
> declarations from the stations that follow by a blank line.  Otherwise
> this looks ok to me.

  Does this apply to both uninitialized and initialized variables?

Would the code hereafter be correct, or did I add too many empty lines?


+/* Check that the code pointed to by PC corresponds to a call to
+   __main, skip it if so.  Return PC otherwise.  */
+
+CORE_ADDR
+i386_skip_main_constructor_call (struct gdbarch *gdbarch, CORE_ADDR pc)
+{
+  gdb_byte op;
+
+  target_read_memory (pc, &op, 1);
+  if (op == 0xe8)
+    {
+      gdb_byte buf[4];
+
+      if (target_read_memory (pc + 1, buf, sizeof buf) == 0)
+       {
+         CORE_ADDR call_dest = pc + 5 + extract_unsigned_integer (buf, 4);
+
+         struct minimal_symbol *s = lookup_minimal_symbol_by_pc
(call_dest);
+
+         if (s != NULL
+             && SYMBOL_LINKAGE_NAME (s) != NULL
+             && strcmp (SYMBOL_LINKAGE_NAME (s), "__main") == 0)
+           pc += 5;
+       }
+    }
+
+  return pc;
+}
+

Thanks again for the reply.


Pierre Muller
Pascal language support maintainer for GDB






  reply	other threads:[~2008-05-30 13:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-02 13:26 Pierre Muller
2008-05-04 19:57 ` Pedro Alves
2008-05-30 15:56 ` [PING2] : " Pierre Muller
2008-05-30 17:04   ` Mark Kettenis
2008-05-30 18:18     ` Pierre Muller [this message]
2008-05-30 18:45       ` Pierre Muller
2008-05-30 20:23         ` Mark Kettenis
2008-05-31  2:30           ` Pierre Muller
     [not found]           ` <000301c8c2ea$0c2d72a0$248857e0$@u-strasbg.fr>
2008-06-05 20:27             ` Daniel Jacobowitz
2008-06-05 20:44               ` Mark Kettenis
2008-06-06  7:18                 ` Pierre Muller
2008-06-07  7:48                   ` [RFA] New skip __main version Pierre Muller
2008-06-10 17:56                     ` Mark Kettenis
2008-06-11 23:18                       ` Pierre Muller
2008-05-31 16:06       ` [PING2] : [RFC/RFA] PING: skip __main Daniel Jacobowitz
2008-05-31 23:40       ` Mark Kettenis

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='001901c8c256$06f8be00$14ea3a00$@u-strasbg.fr' \
    --to=muller@ics.u-strasbg.fr \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    --cc=pedro@codesourcery.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