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:45:00 -0000	[thread overview]
Message-ID: <001a01c8c263$f493b1d0$ddbb1570$@u-strasbg.fr> (raw)
In-Reply-To: <001901c8c256$06f8be00$14ea3a00$@u-strasbg.fr>

+  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);
  Just one small question about this line:
I fear that this line is incorrect,
shouldn't we use extract_signed_integer here?

  The address is relative to pc+5 meaning that
if main is at a higher address than __main,
buf will contain a negative 4byte integer.

  This will usually not matter (if overflows are allowed), 
unless CORE_ADDR is 8-byte long, 
which would then give a value above 0xffffffff.

  This can happen for cross configured gdb, but also if gdb is configured
with --enable-64bit-bfd.

  I don't even know if these result would be always correct
(assuming for instance that main is below __main, but that
__main resides above 0x80000000 boundary for example).

  Maybe the only correct way is to force the operation to be performed
with 4-byte integers and take the result, even if overflow
occurred.


Pierre Muller
Pascal language support maintainer for GDB



  



  reply	other threads:[~2008-05-30 14:47 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
2008-05-30 18:45       ` Pierre Muller [this message]
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='001a01c8c263$f493b1d0$ddbb1570$@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