From 48852b4dc8299e550c15e9a8e6a1b7afd5a437bb Mon Sep 17 00:00:00 2001 From: Hannes Domani Date: Sun, 17 Apr 2022 14:30:55 +0200 Subject: [PATCH] PDB: bitfields --- gdb/windows-nat.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index fefdee0b6ea..b9b909c0377 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -3578,7 +3578,6 @@ static type *get_pdb_type_cached (pdb_line_info *pli, DWORD type_index) + children * sizeof (ULONG))); members->Count = children; members->Start = 0; - // TODO: bitfields if (pli->fSymGetTypeInfo (pli->p, pli->addr, type_index, TI_FINDCHILDREN, members.get ())) { @@ -3610,7 +3609,19 @@ static type *get_pdb_type_cached (pdb_line_info *pli, DWORD type_index) t->field (i).set_type (get_pdb_type (pli, tid)); t->field (i).set_name (wchar_to_objfile (pli, nameW)); - t->field (i).set_loc_bitpos (ofs * 8); + DWORD bitofs = 0; + DWORD bitpos; + if (pli->fSymGetTypeInfo + (pli->p, pli->addr, members->ChildId[i], + TI_GET_BITPOSITION, &bitpos) + && pli->fSymGetTypeInfo + (pli->p, pli->addr, members->ChildId[i], + TI_GET_LENGTH, &length)) + { + bitofs = bitpos; + FIELD_BITSIZE (t->field (i)) = length; + } + t->field (i).set_loc_bitpos (ofs * 8 + bitofs); } } } -- 2.47.2