[llvm] lldbDataFormatters: fix type error in StringRef printer (PR #82554)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 15:54:38 PST 2024


https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/82554

It appears we cannot use keyword arguments for GetPointeeData() and instead have to rely on positional arguments.

```
Traceback (most recent call last):
  File ".../llvm-project/llvm/utils/lldbDataFormatters.py", line 245, in StringRefSummaryProvider
    data = valobj.GetChildAtIndex(0).GetPointeeData(item_count=length)
TypeError: GetPointeeData() got an unexpected keyword argument 'item_count'
```

>From d9506f6fba41ebd0425d8a99446299cf2a2bbb40 Mon Sep 17 00:00:00 2001
From: Alex Richardson <alexrichardson at google.com>
Date: Wed, 21 Feb 2024 15:52:52 -0800
Subject: [PATCH] lldbDataFormatters: fix type error in StringRef printer

It appears we cannot use keyword arguments for GetPointeeData() and instead
have to rely on positional arguments.

```
Traceback (most recent call last):
  File ".../llvm-project/llvm/utils/lldbDataFormatters.py", line 245, in StringRefSummaryProvider
    data = valobj.GetChildAtIndex(0).GetPointeeData(item_count=length)
TypeError: GetPointeeData() got an unexpected keyword argument 'item_count'
```
---
 llvm/utils/lldbDataFormatters.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/utils/lldbDataFormatters.py b/llvm/utils/lldbDataFormatters.py
index 4a34ad2a87c331..3e11d4b1d37e5d 100644
--- a/llvm/utils/lldbDataFormatters.py
+++ b/llvm/utils/lldbDataFormatters.py
@@ -242,7 +242,7 @@ def StringRefSummaryProvider(valobj, internal_dict):
         if length == 0:
             return '""'
 
-        data = valobj.GetChildAtIndex(0).GetPointeeData(item_count=length)
+        data = valobj.GetChildAtIndex(0).GetPointeeData(0, length)
         error = lldb.SBError()
         string = data.ReadRawData(error, 0, data.GetByteSize()).decode()
         if error.Fail():



More information about the llvm-commits mailing list