This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PING2] : [RFC/RFA] PING: skip __main


+  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



  



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]