This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Two minor issues
- From: "Dr. Rolf Jansen" <rolf dot anroni at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 27 Aug 2008 08:55:56 -0300
- Subject: Two minor issues
6.8.50.20080826-cvs
This GDB was configured as "--host=powerpc-apple-darwin9.4.0 --
target=i386-mingw32msvc"
1. remote.c does not compile because the new function
remote_bfd_iovec_stat() makes a reference to the stat structure and
that is not defined by default on MaC OS X. In order to fix this I
added "#include <sys/stat.h>" somewhere at the top of the file.
2. quite at the top of objc-lang.c the Class structure is declared:
struct objc_class {
CORE_ADDR isa;
CORE_ADDR super_class;
CORE_ADDR name;
long version;
long info;
long instance_size;
CORE_ADDR ivars;
CORE_ADDR methods;
CORE_ADDR cache;
CORE_ADDR protocols;
};
In read_objc_class() a variable of that struct type is filled with the
contents at a CORE_ADDR:
static void
read_objc_class (CORE_ADDR addr, struct objc_class *class)
{
class->isa = read_memory_unsigned_integer (addr, 4);
class->super_class = read_memory_unsigned_integer (addr + 4, 4);
class->name = read_memory_unsigned_integer (addr + 8, 4);
class->version = read_memory_unsigned_integer (addr + 12, 4);
class->info = read_memory_unsigned_integer (addr + 16, 4);
class->instance_size = read_memory_unsigned_integer (addr + 18,
4);
class->ivars = read_memory_unsigned_integer (addr + 24, 4);
class->methods = read_memory_unsigned_integer (addr + 28, 4);
class->cache = read_memory_unsigned_integer (addr + 32, 4);
class->protocols = read_memory_unsigned_integer (addr + 36, 4);
}
As a matter of fact, this code works only for targets with a pointer-
size and long-size of 4-bytes, but even with this, the offset to class-
>instance_size shall be 20 and not 18.
Is there a global way to find out at compile-time at the build or host
system the ptr-size and the long-size of the configured target
machine, something like size_attarget_of()?
Best regards
Rolf