[PATCH] D81144: [MC] Generate .debug_line in the 64-bit DWARF format [2/7]

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 16 00:31:04 PDT 2020


jhenderson added inline comments.


================
Comment at: llvm/test/MC/ELF/gen-dwarf64.s:20
+# DUMP5-NEXT: file_names[  0]:
+# DUMP5-NEXT:            name: .debug_line_str[0x00000000[[FILEOFF:[[:xdigit:]]{8}]]] = "[[FILE:.+]]"
+# DUMP5-NEXT:       dir_index: 0
----------------
MaskRay wrote:
> jhenderson wrote:
> > thopre wrote:
> > > thopre wrote:
> > > > jhenderson wrote:
> > > > > ikudrin wrote:
> > > > > > jhenderson wrote:
> > > > > > > FileCheck has relatively recently been extended to improve numeric variable capturing. You can change this line to something like:
> > > > > > > 
> > > > > > > `name: .debug_line_str[0x00000000[[#FILEOFF:]]] = "[[FILE:.+]]"`
> > > > > > > 
> > > > > > > and the usage to: `0x[[#FILEOFF]]`.
> > > > > > > 
> > > > > > > Beware that there are some issues relating to leading zeros that I can't quite remember the details of.
> > > > > > I believe the feature would be great if there was a need for an expression, but here we can just compare exact strings.
> > > > > > 
> > > > > > With numeric substitutions, the first match would be something like `0x[[#%x,FILEOFF:]]`, and the usage would look like `0x{{0*}}[[#FILEOFF]]`. To my taste, the current variant is much simpler. Moreover, the current variant shows the exact number of hex digits we expect in the dump, which is, AFAIK, impossible with numeric substitutions.
> > > > > Wanting to check the exact number of digits sounds reasonable to me. Possibly deserves an extension to the FileCheck expression parser at some point too. @thopre - thoughts on that? It seems related to our previous discussion about leading zeros too.
> > > > Something like [[# %#.8x, FILEOFF:]] (to follow printf format) then? Looks easy enough of a feature to add.
> > > I meant `[[# %#.8x, FILEOFF:]]` of course
> > Yeah, that sort of thing, exactly.
> `[[ # %#.8x, FILEOFF:]]` looks good to me.
> 
> Sometimes the variable is not referenced. Is it worthwhile adding another syntax omitting the variable?
If I'm not mistaken (@thopre can confirm), it's already possible to do that. For example `[[#]]` just matches a number, with no specific constraint. I haven't actually tried, but I'd expect `[[# %x]]` to match a hex number and so on. For reference, some basic precision support is being added at D81667. Feedback is actively being sought there.


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

https://reviews.llvm.org/D81144





More information about the llvm-commits mailing list