Skip to content

dt command: no type code for std::nullptr_t  #2655

Open
@k4lizen

Description

Description

The dt command throws an exception on dt std::nullptr_t.

Steps to reproduce

Compile any cpp program.

pwndbg> dt std::nullptr_t
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ ------------------------/pwndbg/pwndbg/commands/__init__.py:189 in __call__                      │
│                                                                                                  │
│   186 │                                                                                          │
│   187 │   def __call__(self, *args: Any, **kwargs: Any) -> str | None:                           │
│   188 │   │   try:                                                                               │
│ ❱ 189 │   │   │   return self.function(*args, **kwargs)                                          │
│   190 │   │   except TypeError:                                                                  │
│   191 │   │   │   print(f"{self.function.__name__.strip()!r}: {self.function.__doc__.strip()}"   │
│   192 │   │   │   pwndbg.exception.handle(self.function.__name__)                                │
│                                                                                                  │
│ ------------------------/pwndbg/pwndbg/commands/dt.py:35 in dt                                   │
│                                                                                                  │
│   32 │   if address is not None:                                                                 │
│   33 │   │   address = pwndbg.commands.fix(str(address))                                         │
│   34 │                                                                                           │
│ ❱ 35 │   print(pwndbg.aglib.dt.dt(typename, addr=address))                                       │
│   36                                                                                             │
│                                                                                                  │
│ ------------------------/pwndbg/pwndbg/aglib/dt.py:75 in dt                                      │
│                                                                                                  │
│    72 │   │   header = f"{header} @ {hex(int(obj.address))}"                                     │
│    73 │   rv.append(header)                                                                      │
│    74 │                                                                                          │
│ ❱  75 │   if t.strip_typedefs().code == pwndbg.dbg_mod.TypeCode.ARRAY:                           │
│    76 │   │   return "Arrays not supported yet"                                                  │
│    77 │                                                                                          │
│    78 │   if t.strip_typedefs().code not in (                                                    │
│                                                                                                  │
│ ------------------------/pwndbg/pwndbg/dbg/gdb.py:940 in code                                    │
│                                                                                                  │
│    937 │   @property                                                                             │
│    938 │   @override                                                                             │
│    939 │   def code(self) -> pwndbg.dbg_mod.TypeCode:                                            │
│ ❱  940 │   │   assert self.inner.code in GDBType.CODE_MAPPING, "missing mapping for type code"   │
│    941 │   │   return GDBType.CODE_MAPPING[self.inner.code]                                      │
│    942 │                                                                                         │
│    943 │   @override                                                                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AssertionError: missing mapping for type code
pwndbg> ptype/xo std::nullptr_t
type = void
pwndbg> 

My setup

Gdb: 15.2
Python: 3.12.7
Pwndbg: 2024.08.29 build: 1c3e950
Capstone: 5.0.1280
Unicorn: 2.1.0

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions