]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PDB: bitfields
authorHannes Domani <ssbssa@yahoo.de>
Sun, 17 Apr 2022 12:30:55 +0000 (14:30 +0200)
committerHannes Domani <ssbssa@yahoo.de>
Mon, 18 Apr 2022 14:27:56 +0000 (16:27 +0200)
gdb/windows-nat.c

index fefdee0b6ea188969e35cf929f871392ad79bcb2..b9b909c0377416c79ce0d497369dce96bbc8c959 100644 (file)
@@ -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);
                            }
                        }
                    }