[Lldb-commits] [PATCH] D85376: Fix how ValueObjectChild handles bit-fields stored in a Scalar in UpdateValue()

Frederic Riss via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 12 16:06:29 PDT 2020


friss added inline comments.


================
Comment at: lldb/test/Shell/SymbolFile/DWARF/valueobject-pass-by-reg.s:14-40
+# typedef union
+# {
+#   unsigned raw;
+#   struct
+#   {
+#     unsigned a : 8;
+#     unsigned b : 8;
----------------
This gives a much more compact debug info section:
```
typedef union {
  unsigned raw;
  struct {
     unsigned a : 8;
     unsigned b : 8;
     unsigned c : 6;
     unsigned d : 2;
     unsigned e : 6;
     unsigned f : 2;
  };
} U;

// This appears first in the debug info and pulls the type definition in...
static U __attribute__((used)) _type_anchor;
// ... then our useful variable appears last in the debug info and we can
// tweak the assembly without needing to edit a lot of offsets by hand.
static U ug;

extern void f(U);

// Omit debug info for main.
__attribute__((nodebug))
int main() {
  ug.raw = 0x64A40101;
  f(ug);
  f((U)ug.raw);
}
```

You can easily edit out the TEXT section, the line table and the accelerator tables and patch the location expression to give you a minimal binary.


================
Comment at: lldb/test/Shell/SymbolFile/DWARF/valueobject-pass-by-reg.s:62-63
+
+	.section	__TEXT,__text,regular,pure_instructions
+	.build_version macos, 10, 15	sdk_version 10, 15, 6
+	.file	1 "/tmp" "weird.c"
----------------
I don't think you need the TEXT segment at all, or at least you can make it empty.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85376/new/

https://reviews.llvm.org/D85376



More information about the lldb-commits mailing list