Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdb/commands/linux/internal/slub_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def entries_per_slab(cache: drgn.Object) -> int:
Uses drgn's slab_cache_objects_per_slab() helper.
"""
assert sdb.type_canonical_name(cache.type_) == 'struct kmem_cache *'
return slab_cache_objects_per_slab(cache)
return int(slab_cache_objects_per_slab(cache))


def entry_size(cache: drgn.Object) -> int:
Expand Down
13 changes: 7 additions & 6 deletions sdb/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import json
from dataclasses import dataclass
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional, Tuple
from typing import Any, Callable, cast, Dict, List, Optional, Tuple

from kdumpling import CompressionType, KdumpBuilder, OutputFormat

Expand Down Expand Up @@ -489,14 +489,15 @@ def extract_sdb_notes(vmcore_path: str) -> Optional[Dict[str, Any]]:
"""
try:
from elftools.elf.elffile import ELFFile
from elftools.elf.segments import NoteSegment

with open(vmcore_path, 'rb') as f:
elf = ELFFile(f) # type: ignore[no-untyped-call]
for segment in elf.iter_segments(): # type: ignore[no-untyped-call]
elf = ELFFile(f)
for segment in elf.iter_segments():
if segment['p_type'] == 'PT_NOTE':
for note in segment.iter_notes():
if note['n_name'] == 'SDB' and note[
'n_type'] == SDB_NOTE_SESSION:
for note in cast(NoteSegment, segment).iter_notes():
note_type = cast(int, note['n_type'])
if note['n_name'] == 'SDB' and note_type == SDB_NOTE_SESSION:
data = note['n_desc']
if isinstance(data, bytes):
result: Dict[str, Any] = json.loads(
Expand Down
Loading