Skip to content

Replace pwnlib.asm.asm with pwndbg.lib.zig.asm#3207

Merged
disconnect3d merged 9 commits intopwndbg:devfrom
patryk4815:zig-asm
Aug 8, 2025
Merged

Replace pwnlib.asm.asm with pwndbg.lib.zig.asm#3207
disconnect3d merged 9 commits intopwndbg:devfrom
patryk4815:zig-asm

Conversation

@patryk4815
Copy link
Member

@patryk4815 patryk4815 commented Aug 6, 2025

Before:
Zrzut ekranu 2025-08-6 o 04 26 28

After:
image

@k4lizen
Copy link
Contributor

k4lizen commented Aug 6, 2025

I think at this point we can remove this comment from pyproject.toml

    # Optional? only for 'cymbol' command
    "ziglang==0.14.1",
]

@patryk4815
Copy link
Member Author

PR fixed

@disconnect3d disconnect3d requested a review from Copilot August 6, 2025 22:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces pwnlib.asm.asm with a new pwndbg.lib.zig.asm implementation to handle assembly compilation using Zig as the backend. The change removes the dependency on pwntools' assembly functionality and introduces a custom Zig-based assembler with support for multiple architectures.

  • Replaces all pwnlib.asm.asm calls with pwndbg.aglib.asm.asm
  • Implements a new Zig-based assembly compilation system with comprehensive architecture support
  • Adds extensive unit tests for the new assembler functionality

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pwndbg/lib/zig.py Implements the core Zig-based assembly compilation functionality with architecture mappings
pwndbg/aglib/asm.py Provides the public API wrapper for the Zig assembler with pwntools compatibility
tests/unit_tests/test_zig_asm.py Comprehensive test suite validating assembly compilation across multiple architectures
pwndbg/gdblib/shellcode.py Updates import and function call to use new assembler
pwndbg/commands/search.py Removes architecture parameter and uses new assembler API
pwndbg/commands/msr.py Updates import and function calls to use new assembler
pwndbg/aglib/shellcode.py Updates import and function call to use new assembler
pyproject.toml Updates dependency comment for ziglang package
docs/commands/memory/search.md Removes documentation for removed --arch parameter
.github/workflows/tests.yml Adds unit-tests to CI pipeline

elif type == "asm" or asmbp:
bits_for_arch = pwnlib.context.context.architectures.get(arch, {}).get("bits")
value = pwnlib.asm.asm(value, arch=arch, bits=bits_for_arch)
value = pwndbg.aglib.asm.asm(value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the previous code we allowed for search cross-arch instructions... but idk if that feature was used by anyone

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷

@patryk4815
Copy link
Member Author

fixed

@disconnect3d disconnect3d merged commit f9f90d9 into pwndbg:dev Aug 8, 2025
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants