<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/lldb/source/DataFormatters/FormattersHelpers.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[lldb][Formatters] Use container summary helper for libstdc++ formatters (#147140)</title>
<updated>2025-07-07T08:04:40+00:00</updated>
<author>
<name>Michael Buch</name>
<email>michaelbuch12@gmail.com</email>
</author>
<published>2025-07-07T08:04:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d06956e24afaed103dfbcc67e81257692ae0a8b2'/>
<id>d06956e24afaed103dfbcc67e81257692ae0a8b2</id>
<content type='text'>
This re-uses the `LibcxxContainerSummaryProvider` for the libstdc++
formatters. There's a couple of containers that aren't making use of it
for libstdc++. This patch will make it easier to review when adding
those in the future.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This re-uses the `LibcxxContainerSummaryProvider` for the libstdc++
formatters. There's a couple of containers that aren't making use of it
for libstdc++. This patch will make it easier to review when adding
those in the future.</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb][DataFormatter] Format libstdc++ unique_ptr like we do libc++ (#146909)</title>
<updated>2025-07-04T08:18:24+00:00</updated>
<author>
<name>Michael Buch</name>
<email>michaelbuch12@gmail.com</email>
</author>
<published>2025-07-04T08:18:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a89e232058a29260eb9bfe77b862715ce875f962'/>
<id>a89e232058a29260eb9bfe77b862715ce875f962</id>
<content type='text'>
The only difference is that with libc++ the summary string contains the
derefernced pointer value. With libstdc++ we currently display the
pointer itself, which seems redundant. E.g.,
```
(std::unique_ptr&lt;int&gt;) iup = 0x55555556d2b0 {
  pointer = 0x000055555556d2b0
}
(std::unique_ptr&lt;std::basic_string&lt;char&gt; &gt;) sup = 0x55555556d2d0 {
  pointer = "foobar"
}
```

This patch moves the logic into a common helper that's shared between
the libc++ and libstdc++ formatters.

After this patch we can combine the libc++ and libstdc++ API tests (see
https://github.com/llvm/llvm-project/pull/146740).</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The only difference is that with libc++ the summary string contains the
derefernced pointer value. With libstdc++ we currently display the
pointer itself, which seems redundant. E.g.,
```
(std::unique_ptr&lt;int&gt;) iup = 0x55555556d2b0 {
  pointer = 0x000055555556d2b0
}
(std::unique_ptr&lt;std::basic_string&lt;char&gt; &gt;) sup = 0x55555556d2d0 {
  pointer = "foobar"
}
```

This patch moves the logic into a common helper that's shared between
the libc++ and libstdc++ formatters.

After this patch we can combine the libc++ and libstdc++ API tests (see
https://github.com/llvm/llvm-project/pull/146740).</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Refactor away UB in SBValue::GetLoadAddress (#141799)</title>
<updated>2025-06-02T07:39:56+00:00</updated>
<author>
<name>Pavel Labath</name>
<email>pavel@labath.sk</email>
</author>
<published>2025-06-02T07:39:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e9fad0e91c49ca0f2669989dbad95664cbc9cbf3'/>
<id>e9fad0e91c49ca0f2669989dbad95664cbc9cbf3</id>
<content type='text'>
The problem was in calling GetLoadAddress on a value in the error state,
where `ValueObject::GetLoadAddress` could end up accessing the
uninitialized "address type" by-ref return value from `GetAddressOf`.
This probably happened because each function expected the other to
initialize it.

We can guarantee initialization by turning this into a proper return
value.

I've added a test, but it only (reliably) crashes if lldb is built with
ubsan.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The problem was in calling GetLoadAddress on a value in the error state,
where `ValueObject::GetLoadAddress` could end up accessing the
uninitialized "address type" by-ref return value from `GetAddressOf`.
This probably happened because each function expected the other to
initialize it.

We can guarantee initialization by turning this into a proper return
value.

I've added a test, but it only (reliably) crashes if lldb is built with
ubsan.</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb][DataFormatters] Change ExtractIndexFromString to return std::optional (#138297)</title>
<updated>2025-05-08T11:21:26+00:00</updated>
<author>
<name>Charles Zablit</name>
<email>c_zablit@apple.com</email>
</author>
<published>2025-05-08T11:21:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0d47a4548c17b320e02e33a1e250792626652e59'/>
<id>0d47a4548c17b320e02e33a1e250792626652e59</id>
<content type='text'>
This PR is in continuation of
https://github.com/llvm/llvm-project/pull/136693.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR is in continuation of
https://github.com/llvm/llvm-project/pull/136693.</pre>
</div>
</content>
</entry>
<entry>
<title>Re-land "[lldb] Make the libcxx unique_ptr prettyprinter support custom deleters."</title>
<updated>2023-05-01T23:19:01+00:00</updated>
<author>
<name>Jorge Gorbe Moya</name>
<email>jgorbe@google.com</email>
</author>
<published>2023-05-01T22:57:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d69518b4e52d527b3f8fcc41e90ae21f1f234555'/>
<id>d69518b4e52d527b3f8fcc41e90ae21f1f234555</id>
<content type='text'>
This reverts commit 45351120105a7257ccb1e38ec1b1f8a452269da2.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 45351120105a7257ccb1e38ec1b1f8a452269da2.
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[lldb] Make the libcxx unique_ptr prettyprinter support custom deleters."</title>
<updated>2023-05-01T21:14:09+00:00</updated>
<author>
<name>Jorge Gorbe Moya</name>
<email>jgorbe@google.com</email>
</author>
<published>2023-05-01T21:13:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=45351120105a7257ccb1e38ec1b1f8a452269da2'/>
<id>45351120105a7257ccb1e38ec1b1f8a452269da2</id>
<content type='text'>
This reverts commit d366da97bd24ddfb91c9f260fa0aaf105d947652.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit d366da97bd24ddfb91c9f260fa0aaf105d947652.
</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Make the libcxx unique_ptr prettyprinter support custom deleters.</title>
<updated>2023-05-01T20:08:04+00:00</updated>
<author>
<name>Jorge Gorbe Moya</name>
<email>jgorbe@google.com</email>
</author>
<published>2023-04-18T20:19:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d366da97bd24ddfb91c9f260fa0aaf105d947652'/>
<id>d366da97bd24ddfb91c9f260fa0aaf105d947652</id>
<content type='text'>
The unique_ptr prettyprinter calls `GetValueOfLibCXXCompressedPair`,
which looks for a `__value_` child. However, when the second value in
the compressed pair is not an empty class, there are two `__value_`
children because `__compressed_pair` derives twice from
`__compressed_pair_elem`, one for each member of the pair. And then the
lookup fails because it's ambiguous.

This patch makes the following changes:

- Rename `GetValueOfLibCXXCompressedPair` to
  `GetFirstValueOfLibCXXCompressedPair`, and add a similar function to
  get the second value. Put both functions in
  Plugin/Language/CPlusPlus/LibCxx.cpp because it seems inappropriate to
  have libcxx-specific helpers separate from all the libcxx-dependent
  code.

- Read the second value of the `__ptr_` pair and display a "deleter"
  child in the unique_ptr synthetic child provider, when available.

- Add a test case for the non-empty deleter case.

Differential Revision: https://reviews.llvm.org/D148662
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The unique_ptr prettyprinter calls `GetValueOfLibCXXCompressedPair`,
which looks for a `__value_` child. However, when the second value in
the compressed pair is not an empty class, there are two `__value_`
children because `__compressed_pair` derives twice from
`__compressed_pair_elem`, one for each member of the pair. And then the
lookup fails because it's ambiguous.

This patch makes the following changes:

- Rename `GetValueOfLibCXXCompressedPair` to
  `GetFirstValueOfLibCXXCompressedPair`, and add a similar function to
  get the second value. Put both functions in
  Plugin/Language/CPlusPlus/LibCxx.cpp because it seems inappropriate to
  have libcxx-specific helpers separate from all the libcxx-dependent
  code.

- Read the second value of the `__ptr_` pair and display a "deleter"
  child in the unique_ptr synthetic child provider, when available.

- Add a test case for the non-empty deleter case.

Differential Revision: https://reviews.llvm.org/D148662
</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Change formatter helper function parameter list to remove ConstString</title>
<updated>2023-04-12T18:20:24+00:00</updated>
<author>
<name>Alex Langford</name>
<email>alangford@apple.com</email>
</author>
<published>2023-04-11T21:06:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0e22b8cba786a5da61b9279c4d2d10c756392a2e'/>
<id>0e22b8cba786a5da61b9279c4d2d10c756392a2e</id>
<content type='text'>
All of these functions take a ConstString for the type_name,
but this isn't really needed for two reasons:
1.) This parameter is always constructed from a static c-string
  constant.
2.) They are passed along to to `AddTypeSummary` as a StringRef anyway.

Differential Revision: https://reviews.llvm.org/D148050
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
All of these functions take a ConstString for the type_name,
but this isn't really needed for two reasons:
1.) This parameter is always constructed from a static c-string
  constant.
2.) They are passed along to to `AddTypeSummary` as a StringRef anyway.

Differential Revision: https://reviews.llvm.org/D148050
</pre>
</div>
</content>
</entry>
<entry>
<title>[NFCI] More TypeCategoryImpl refactoring.</title>
<updated>2022-10-10T22:14:55+00:00</updated>
<author>
<name>Jorge Gorbe Moya</name>
<email>jgorbe@google.com</email>
</author>
<published>2022-09-22T18:00:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e5fd507f9b6f774c83c7b061fa77c906c882935b'/>
<id>e5fd507f9b6f774c83c7b061fa77c906c882935b</id>
<content type='text'>
The main aim of this patch is to delete the remaining instances of code
reaching into the internals of `TypeCategoryImpl`. I made the following
changes:

- Add some more methods to `TieredFormatterContainer` and
  `TypeCategoryImpl` to expose functionality that is implemented in
  `FormattersContainer`.

- Add new overloads of `TypeCategoryImpl::AddTypeXXX` to make it easier
  to add formatters to categories without reaching into the internal
  `FormattersContainer` objects.

- Remove the `GetTypeXXXContainer` and `GetRegexTypeXXXContainer`
  accessors from `TypeCategoryImpl` and update all call sites to use the
  new methods instead.

Differential Revision: https://reviews.llvm.org/D135399
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The main aim of this patch is to delete the remaining instances of code
reaching into the internals of `TypeCategoryImpl`. I made the following
changes:

- Add some more methods to `TieredFormatterContainer` and
  `TypeCategoryImpl` to expose functionality that is implemented in
  `FormattersContainer`.

- Add new overloads of `TypeCategoryImpl::AddTypeXXX` to make it easier
  to add formatters to categories without reaching into the internal
  `FormattersContainer` objects.

- Remove the `GetTypeXXXContainer` and `GetRegexTypeXXXContainer`
  accessors from `TypeCategoryImpl` and update all call sites to use the
  new methods instead.

Differential Revision: https://reviews.llvm.org/D135399
</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] (Partially) enable formatting of utf strings before the program is started</title>
<updated>2021-11-18T13:45:17+00:00</updated>
<author>
<name>Pavel Labath</name>
<email>pavel@labath.sk</email>
</author>
<published>2021-11-03T12:43:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4c56f734b35dd3e16b75da46c023cd4b92f83f8c'/>
<id>4c56f734b35dd3e16b75da46c023cd4b92f83f8c</id>
<content type='text'>
The StringPrinter class was using a Process instance to read memory.
This automatically prevented it from working before starting the
program.

This patch changes the class to use the Target object for reading
memory, as targets are always available. This required moving
ReadStringFromMemory from Process to Target.

This is sufficient to make frame/target variable work, but further
changes are necessary for the expression evaluator. Preliminary analysis
indicates the failures are due to the expression result ValueObjects
failing to provide an address, presumably because we're operating on
file addresses before starting. I haven't looked into what would it take
to make that work.

Differential Revision: https://reviews.llvm.org/D113098
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The StringPrinter class was using a Process instance to read memory.
This automatically prevented it from working before starting the
program.

This patch changes the class to use the Target object for reading
memory, as targets are always available. This required moving
ReadStringFromMemory from Process to Target.

This is sufficient to make frame/target variable work, but further
changes are necessary for the expression evaluator. Preliminary analysis
indicates the failures are due to the expression result ValueObjects
failing to provide an address, presumably because we're operating on
file addresses before starting. I haven't looked into what would it take
to make that work.

Differential Revision: https://reviews.llvm.org/D113098
</pre>
</div>
</content>
</entry>
</feed>
