Debian Codegraph @

js/src/gdb/mozilla/CellHeader.py

raw
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 # You can obtain one at http://mozilla.org/MPL/2.0/.
4
5 import gdb
6
7
8 def get_header_ptr(value, ptr_t):
9 # Return the pointer stored in Cell::header_ for subclasses of
10 # TenuredCellWithNonGCPointer and CellWithTenuredGCPointer.
11 return value["header_"]["value_"].cast(ptr_t)
12
13
14 def get_header_length_and_flags(value, cache):
15 # Return the length and flags values for subclasses of
16 # CellWithLengthAndFlags.
17 flags = value["header_"]["value_"].cast(cache.uintptr_t)
18 try:
19 length = value["length_"]
20 except gdb.error:
21 # If we couldn't fetch the length directly, it must be stored
22 # within `flags`.
23 length = flags >> 32
24 flags = flags % 2**32
25 return length, flags