[Lldb-commits] [PATCH] D146297: [lldb][gnustep][PDB] Parse ObjC base classes and recognize NSObject type
Stefan Gränitz via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 17 08:45:50 PDT 2023
sgraenitz added a comment.
In D146297#4202172 <https://reviews.llvm.org/D146297#4202172>, @DavidSpickett wrote:
> I don't know anything about Objective C internals, perhaps you can provide some reference that talks about this?
Honestly, I am mostly looking what the DWARF parser does and try to mimic it in PDB. I haven't done much research for a formal reference. My impression is that the implementation is the reference here. (Please correct me if I am wrong!)
Yeah, let's wait and see if I get feedback from ObjC and PDB maintainers.
================
Comment at: lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp:349
+static bool IsSpecialNameObjC(llvm::StringRef name) {
+ return name == "objc_object" || name == "objc_class";
+}
----------------
Maybe this is ok without a dedicated language type check? IIUC the worst thing that could happen, in case we really have zero-length types with such names in C++ code, is a small performance drop.
BTW the reference for this seems to be: https://github.com/llvm/llvm-project/blob/release/16.x/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp#L709-L710 😄
================
Comment at: lldb/test/Shell/Expr/objc-gnustep-print-pdb.m:44
-// RUN: %lldb -b -o "b objc-gnustep-print-pdb.m:67" -o "run" -o "p ptr" -o "p *ptr" -- %t | FileCheck %s
+// RUN: %lldb -b -o "b objc-gnustep-print-pdb.m:72" -o "run" -o "p ptr" -o "p *ptr" -- %t | FileCheck %s
//
----------------
DavidSpickett wrote:
> Could you use label in the source so you don't have to update this line number each each time?
>
> I forget if labels are included in the debug info. In the python tests we have this more heavyweight thing that searches for a particular comment to find the line.
It's a minor effort on my side to update the line number and it's solid. We cannot break on `ok`, since the function name doesn't get parsed with a correct basename yet. Main would work, but it doesn't seem more readable:
```
-o "b main" -o "n" -o "n"
```
> In the python tests we have this more heavyweight thing that searches for a particular comment to find the line.
If possible I'd like to stay away from the Python tests. I don't think we need their advanced features. lit is a lot easier for me (and more widespread in LLVM).
================
Comment at: lldb/test/Shell/Expr/objc-gnustep-print-pdb.m:68
+// CHECK: _id_objc = nil
// CHECK: }
----------------
With this change we get base class and the member offsets right (all are zero-initialized).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146297/new/
https://reviews.llvm.org/D146297
More information about the lldb-commits
mailing list