forked from flang-compiler/f18-llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lldb] Support custom LLVM formatting for variables (llvm#91868)
Re-apply llvm#81196, with a fix that handles the absence of llvm formatting: llvm@3ba650e b47d425f
- Loading branch information
1 parent
e1ed138
commit 8530b1c
Showing
5 changed files
with
106 additions
and
10 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
2 changes: 2 additions & 0 deletions
2
lldb/test/API/functionalities/data-formatter/custom-printf-summary/Makefile
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
C_SOURCES := main.c | ||
include Makefile.rules |
20 changes: 20 additions & 0 deletions
20
...t/API/functionalities/data-formatter/custom-printf-summary/TestCustomSummaryLLVMFormat.py
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import lldb | ||
from lldbsuite.test.lldbtest import * | ||
import lldbsuite.test.lldbutil as lldbutil | ||
|
||
|
||
class TestCase(TestBase): | ||
def test_raw_bytes(self): | ||
self.build() | ||
lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.c")) | ||
self.runCmd("type summary add -s '${var.ubyte:x-2}${var.sbyte:x-2}!' Bytes") | ||
self.expect("v bytes", substrs=[" = 3001!"]) | ||
|
||
def test_bad_format(self): | ||
self.build() | ||
lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.c")) | ||
self.expect( | ||
"type summary add -s '${var.ubyte:y}!' Bytes", | ||
error=True, | ||
substrs=["invalid llvm format"], | ||
) |
13 changes: 13 additions & 0 deletions
13
lldb/test/API/functionalities/data-formatter/custom-printf-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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
|
||
struct Bytes { | ||
uint8_t ubyte; | ||
int8_t sbyte; | ||
}; | ||
|
||
int main() { | ||
struct Bytes bytes = {0x30, 0x01}; | ||
(void)bytes; | ||
printf("break here\n"); | ||
} |