You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove unused Tintype DAP path argument and update docs
Summary:
Remove the redundant `pytb_file` positional argument and its fail-fast exit code from `tintype-dap-server`; DAP clients already provide the authoritative snapshot path through `launch.pytbPath`. Update the CLI tests and internal launcher documentation accordingly.
Also correct the binary-format parsing example and expand the platform, VS Code, CLI, demo, and serialized collection documentation.
Reviewed By: aperez
Differential Revision: D116650471
fbshipit-source-id: 0698e6ff05597efabbc8fcd0729717fb58b15de5
Copy file name to clipboardExpand all lines: PYTHON_API.md
+12-5Lines changed: 12 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -478,7 +478,10 @@ Represents a deserialized complex Python object that doesn't map to a builtin ty
478
478
479
479
### `SerializedListObject(list)`
480
480
481
-
A `list` subclass representing a deserialized list (or list subclass) with a custom repr and additional attributes accessible via `__dict__`.
481
+
A `list` subclass representing a deserialized list, set, or tuple subclass with
482
+
a custom repr and additional attributes accessible via `__dict__`. Collection
483
+
contents are exposed through the list interface even when the captured object
484
+
was a set or tuple subclass.
482
485
483
486
### `SerializedDictObject(dict)`
484
487
@@ -538,17 +541,21 @@ with sampling(interval, path=path):
538
541
539
542
| Command | Description |
540
543
|---------|-------------|
544
+
|`tintype-dap-server [--listen [HOST:]PORT]`| Serve snapshots through the Debug Adapter Protocol. The default transport is stdio; `--listen` enables a loopback TCP listener. Snapshot paths are supplied by the DAP client's `launch.pytbPath` request field. |
541
545
|`python -m tintype.utils.tintype_dump /path/to/file.pytb`| Dump a snapshot file as structured text or JSON. |
Copy file name to clipboardExpand all lines: snapshot_lib/FILE_FORMAT.md
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,10 @@ The Tintype file stores snapshots of Python traceback information including:
10
10
- Source file contents for referenced files
11
11
- User-provided metadata
12
12
13
-
The file is compressed using zstd. All positions (Pos) are absolute byte offsets from the start of the **uncompressed** data. All offsets (Offset) are relative to a section start (e.g., object heap offsets are relative to the object heap start).
13
+
Output files are zstd-compressed by default, but callers can request an
14
+
uncompressed file. All positions (Pos) are absolute byte offsets from the start
15
+
of the **uncompressed** data. All offsets (Offset) are relative to a section
16
+
start (e.g., object heap offsets are relative to the object heap start).
14
17
15
18
All multi-byte integers are stored in little-endian byte order. All on-disk structs use `#pragma pack(push, 1)` to eliminate compiler-inserted alignment padding. This makes the binary format portable across platforms (e.g., files written on Linux can be read on macOS).
16
19
@@ -383,7 +386,9 @@ To read the statistics:
383
386
## Reading the File
384
387
385
388
### Decompression
386
-
The entire file is zstd compressed. Decompress the full file before parsing.
389
+
Read the first four bytes as a little-endian `uint32`. If they equal the magic
390
+
number, the file is already uncompressed and can be parsed directly. Otherwise,
391
+
treat the file as a zstd frame and decompress it fully before parsing.
387
392
388
393
### Output Compaction
389
394
During writing, the working file has a zero-filled gap between the snapshot records section and the object heap (used to allow the snapshot records section to grow without relocating the heap). When the output file is produced, this gap is stripped: the snapshot records are immediately followed by the object heap data, and the `FileHeader` position fields (`objectHeapPos`, `fileTablePos`, `envPos`, `manifestPos`, `metadataPos`, `statsPos`) are adjusted to reflect the compacted layout. The `lastSnapshotPos` and all positions within snapshot records (`prevSnapshotPos`, `objectMapPos`) are not adjusted because they fall before the gap. Readers see a contiguous file with no gap.
@@ -415,10 +420,13 @@ import zstandard
415
420
416
421
defread_snapshot_file(path):
417
422
withopen(path, 'rb') as f:
418
-
compressed= f.read()
423
+
file_data= f.read()
419
424
420
-
dctx = zstandard.ZstdDecompressor()
421
-
data = dctx.decompress(compressed)
425
+
if file_data[:4] == struct.pack('<I', 0x50595442):
426
+
data = file_data
427
+
else:
428
+
dctx = zstandard.ZstdDecompressor()
429
+
data = dctx.decompress(file_data)
422
430
423
431
# Read FileHeader (100 bytes, packed)
424
432
magic, version = struct.unpack_from('<II', data, 0)
0 commit comments