Skip to content

Commit 8cc1ac1

Browse files
committed
Fix GDB pretty-printers to work with GCC and C++26
1 parent 33169aa commit 8cc1ac1

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

extra/boost_unordered_printers.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024-2025 Braden Ganetsky
1+
# Copyright 2024-2026 Braden Ganetsky
22
# Distributed under the Boost Software License, Version 1.0.
33
# https://www.boost.org/LICENSE_1_0.txt
44

@@ -16,8 +16,14 @@ def maybe_unwrap_atomic(n):
1616
return n
1717

1818
def maybe_unwrap_foa_element(e):
19-
if f"{e.type.strip_typedefs()}".startswith("boost::unordered::detail::foa::element_type<"):
20-
return e["p"]
19+
# Sometimes the complex typedefs can't be resolved through a pointer
20+
if e.type.strip_typedefs().code == gdb.TYPE_CODE_PTR:
21+
foa_element = e.dereference()
22+
else:
23+
foa_element = e
24+
25+
if f"{foa_element.type.strip_typedefs()}".startswith("boost::unordered::detail::foa::element_type<"):
26+
return foa_element["p"]
2127
else:
2228
return e
2329

include/boost/unordered/detail/unordered_printers.hpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// Copyright 2024-2025 Braden Ganetsky
1+
// Copyright 2024-2026 Braden Ganetsky
22
// Distributed under the Boost Software License, Version 1.0.
33
// https://www.boost.org/LICENSE_1_0.txt
44

5-
// Generated on 2025-08-21T03:09:19
5+
// Generated on 2026-01-24T00:34:53
66

77
#ifndef BOOST_UNORDERED_DETAIL_UNORDERED_PRINTERS_HPP
88
#define BOOST_UNORDERED_DETAIL_UNORDERED_PRINTERS_HPP
@@ -29,8 +29,14 @@ __asm__(".pushsection \".debug_gdb_scripts\", \"MS\",%progbits,1\n"
2929
".ascii \" return n\\n\"\n"
3030

3131
".ascii \" def maybe_unwrap_foa_element(e):\\n\"\n"
32-
".ascii \" if f\\\"{e.type.strip_typedefs()}\\\".startswith(\\\"boost::unordered::detail::foa::element_type<\\\"):\\n\"\n"
33-
".ascii \" return e[\\\"p\\\"]\\n\"\n"
32+
".ascii \" # Sometimes the complex typedefs can't be resolved through a pointer\\n\"\n"
33+
".ascii \" if e.type.strip_typedefs().code == gdb.TYPE_CODE_PTR:\\n\"\n"
34+
".ascii \" foa_element = e.dereference()\\n\"\n"
35+
".ascii \" else:\\n\"\n"
36+
".ascii \" foa_element = e\\n\"\n"
37+
38+
".ascii \" if f\\\"{foa_element.type.strip_typedefs()}\\\".startswith(\\\"boost::unordered::detail::foa::element_type<\\\"):\\n\"\n"
39+
".ascii \" return foa_element[\\\"p\\\"]\\n\"\n"
3440
".ascii \" else:\\n\"\n"
3541
".ascii \" return e\\n\"\n"
3642

0 commit comments

Comments
 (0)