This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Summary provider for char flexible array members
ClosedPublic

Authored by labath on Nov 4 2021, 2:14 AM.

Details

Summary

Add a summary provider which can print char[] members at the ends of
structs.

Depends on D112709.

Diff Detail

Event Timeline

labath requested review of this revision.Nov 4 2021, 2:14 AM
labath created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptNov 4 2021, 2:14 AM
jingham accepted this revision.EditedNov 4 2021, 11:40 AM
jingham added a subscriber: jingham.

Regex Type summary matching happens after the ConstString matching. Enrico did it that way because the ConstString matching is so much quicker, so if we can find a match there we'll get to it more quickly...

So this patch moves the char * recognition from the beginning of the type summary matching to the end, and potentially makes it a slower match.

I doubt that this will be noticeable on modern systems, however, just something to keep in mind.

It also changes the order of search slightly. I think this is observable: it would mean a regex that happens to match "char *" as well as other things used to not be chosen for "char *" because it would have hit the ConstString summary first. Now it will match, because the built-in regex summary will be checked after the user added ones.

Again, I don't think this is a reason not to do the patch. But something to keep in mind. The code itself looks fine.

This revision is now accepted and ready to land.Nov 4 2021, 11:40 AM

Regex Type summary matching happens after the ConstString matching. Enrico did it that way because the ConstString matching is so much quicker, so if we can find a match there we'll get to it more quickly...

So this patch moves the char * recognition from the beginning of the type summary matching to the end, and potentially makes it a slower match.

I doubt that this will be noticeable on modern systems, however, just something to keep in mind.

It also changes the order of search slightly. I think this is observable: it would mean a regex that happens to match "char *" as well as other things used to not be chosen for "char *" because it would have hit the ConstString summary first. Now it will match, because the built-in regex summary will be checked after the user added ones.

Again, I don't think this is a reason not to do the patch. But something to keep in mind. The code itself looks fine.

I was looking at these char formatters a while ago and IIRC I did see some impact making these regex matches but I don't remember the details and did not look closely (so maybe there was another effect at play) b/c I went with a different approach.

labath added a comment.Nov 9 2021, 5:50 AM

Regex Type summary matching happens after the ConstString matching. Enrico did it that way because the ConstString matching is so much quicker, so if we can find a match there we'll get to it more quickly...

So this patch moves the char * recognition from the beginning of the type summary matching to the end, and potentially makes it a slower match.

I doubt that this will be noticeable on modern systems, however, just something to keep in mind.

It also changes the order of search slightly. I think this is observable: it would mean a regex that happens to match "char *" as well as other things used to not be chosen for "char *" because it would have hit the ConstString summary first. Now it will match, because the built-in regex summary will be checked after the user added ones.

Again, I don't think this is a reason not to do the patch. But something to keep in mind. The code itself looks fine.

I was looking at these char formatters a while ago and IIRC I did see some impact making these regex matches but I don't remember the details and did not look closely (so maybe there was another effect at play) b/c I went with a different approach.

This is still a bounded set, so it is possible to replace this regex with 6 strings. I did a regex because it makes the code shorter, but I have no problem with spelling this out.

This revision was automatically updated to reflect the committed changes.