Index: gdb-7.7.50.20140609/gdb/gdbtypes.h =================================================================== --- gdb-7.7.50.20140609.orig/gdb/gdbtypes.h 2014-06-13 20:23:55.210626427 +0200 +++ gdb-7.7.50.20140609/gdb/gdbtypes.h 2014-06-13 20:24:26.156658622 +0200 @@ -440,6 +440,7 @@ enum field_loc_kind { FIELD_LOC_KIND_BITPOS, /**< bitpos */ FIELD_LOC_KIND_ENUMVAL, /**< enumval */ + /* This address is unrelocated by the objfile's ANOFFSET. */ FIELD_LOC_KIND_PHYSADDR, /**< physaddr */ FIELD_LOC_KIND_PHYSNAME, /**< physname */ FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */ @@ -617,6 +618,7 @@ struct main_type field. Otherwise, physname is the mangled label of the static field. */ + /* This address is unrelocated by the objfile's ANOFFSET. */ CORE_ADDR physaddr; const char *physname; @@ -1262,6 +1264,7 @@ extern void allocate_gnat_aux_type (stru #define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval) #define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0) #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname) +/* This address is unrelocated by the objfile's ANOFFSET. */ #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr) #define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block) #define SET_FIELD_BITPOS(thisfld, bitpos) \ @@ -1273,6 +1276,7 @@ extern void allocate_gnat_aux_type (stru #define SET_FIELD_PHYSNAME(thisfld, name) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \ FIELD_STATIC_PHYSNAME (thisfld) = (name)) +/* This address is unrelocated by the objfile's ANOFFSET. */ #define SET_FIELD_PHYSADDR(thisfld, addr) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \ FIELD_STATIC_PHYSADDR (thisfld) = (addr)) @@ -1289,6 +1293,7 @@ extern void allocate_gnat_aux_type (stru #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n)) +/* This address is unrelocated by the objfile's ANOFFSET. */ #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n)) Index: gdb-7.7.50.20140609/gdb/jv-lang.c =================================================================== --- gdb-7.7.50.20140609.orig/gdb/jv-lang.c 2014-06-13 20:23:55.211626428 +0200 +++ gdb-7.7.50.20140609/gdb/jv-lang.c 2014-06-13 20:23:56.278627534 +0200 @@ -427,7 +427,8 @@ java_link_class_type (struct gdbarch *gd fields = NULL; nfields--; /* First set up dummy "class" field. */ - SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas)); + SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas) + - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type))))); TYPE_FIELD_NAME (type, nfields) = "class"; TYPE_FIELD_TYPE (type, nfields) = value_type (clas); SET_TYPE_FIELD_PRIVATE (type, nfields); @@ -475,7 +476,8 @@ java_link_class_type (struct gdbarch *gd SET_TYPE_FIELD_PROTECTED (type, i); } if (accflags & 0x0008) /* ACC_STATIC */ - SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset); + SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset + - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type))))); else SET_FIELD_BITPOS (TYPE_FIELD (type, i), 8 * boffset); if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */ Index: gdb-7.7.50.20140609/gdb/value.c =================================================================== --- gdb-7.7.50.20140609.orig/gdb/value.c 2014-06-13 20:23:55.212626429 +0200 +++ gdb-7.7.50.20140609/gdb/value.c 2014-06-13 20:23:56.279627535 +0200 @@ -2783,7 +2783,8 @@ value_static_field (struct type *type, i { case FIELD_LOC_KIND_PHYSADDR: retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno), - TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)); + TYPE_FIELD_STATIC_PHYSADDR (type, fieldno) + + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type))))); break; case FIELD_LOC_KIND_PHYSNAME: {