function::usymfile - Linux


Overview

usymfile is a command-line tool used to modify Windows EXEs and DLLs by providing them with an equivalent Unicode symbol file. It allows for improved debugging and compatibility with modern tools.

Syntax

usymfile [-h] [-v] [-d DEST_DIR] [-a] [-s] [-m] [-w] [-r] FILE [FILE ...]

Options/Flags

  • -h, –help: Display usage information and exit.
  • -v, –verbose: Enable verbose output.
  • -d DEST_DIR: Specify the destination directory for modified files. Defaults to the current directory.
  • -a, –analyze: Analyze files without modifying them.
  • -s, –symbol-files: Create symbol files only, without injecting them into EXEs/DLLs.
  • -m, –no-mangle: Disable symbol demangling.
  • -w, –overwrite: Overwrite existing files without confirmation.
  • -r, –recursive: Process files recursively, including subdirectories.

Examples

To modify a single file:

usymfile my_exe.exe

To analyze a file without modifying it:

usymfile -a my_exe.exe

To create only the symbol files for multiple files:

usymfile -s file1.dll file2.dll file3.exe

Common Issues

Error: File is not a PE file

Ensure that the file you are attempting to modify is a valid Windows PE file.

Error: Symbol file creation failed

Make sure that a symbol server is accessible and that the necessary debug symbols are available.

Files not updated

Verify that you have write permissions to the destination directory and that the files are not locked by another process.

Integration

With GDB:

gdb -ex "add-symbol-file $(usymfile -s FILE.exe)" FILE.exe

Related Commands

  • objdump: Display information about object files.
  • strip: Remove symbols from object files.
  • cvs: Concurrent Version System for managing code changes.