-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lldb] Support zero-padding in formatter sections (#119934)
- Loading branch information
1 parent
d015578
commit f22cff7
Showing
3 changed files
with
37 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 29 additions & 8 deletions
37
lldb/test/API/functionalities/data-formatter/embedded-summary/main.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,43 @@ | ||
#include <stdio.h> | ||
void puts(const char *); | ||
|
||
#define LLDBSUMMARY __attribute__((section("__TEXT,__lldbsummaries"), used)) | ||
|
||
struct Player { | ||
char *name; | ||
int number; | ||
}; | ||
|
||
__attribute__((used, section("__DATA_CONST,__lldbsummaries"))) unsigned char | ||
_Player_type_summary[] = "\x01" // version | ||
"\x25" // record size | ||
"\x07" // type name size | ||
"Player\0" // type name | ||
"\x1c" // summary string size | ||
"${var.name} (${var.number})"; // summary string | ||
LLDBSUMMARY unsigned char _Player_type_summary[] = | ||
"\x01" // version | ||
"\x25" // record size | ||
"\x07" // type name size | ||
"Player\0" // type name | ||
"\x1c" // summary string size | ||
"${var.name} (${var.number})"; // summary string | ||
|
||
struct Layer { | ||
char *name; | ||
int number; | ||
}; | ||
|
||
LLDBSUMMARY unsigned char _padding[] = "\x00\x00"; | ||
|
||
// Near copy of the record for `Player`, using a regex type name (`^Layer`). | ||
LLDBSUMMARY unsigned char _Layer_type_summary[] = | ||
"\x01" // version | ||
"\x25" // record size | ||
"\x07" // type name size | ||
"^Layer\0" // type name | ||
"\x1c" // summary string size | ||
"${var.name} (${var.number})"; // summary string | ||
|
||
int main() { | ||
struct Player player; | ||
player.name = "Dirk"; | ||
player.number = 41; | ||
struct Layer layer; | ||
layer.name = "crust"; | ||
layer.number = 3; | ||
puts("break here"); | ||
return 0; | ||
} |