Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cwrappers

cwrappers is a Python CLI toolkit for finding wrapper-like C/C++ functions (libc/syscall oriented) and optionally ranking them with fuzzy matching.

It is designed around compile_commands.json and Clang AST parsing.

Install

Editable install:

python3 -m pip install -e .

This exposes three console scripts:

  • cwrappers
  • cwrappers-finder
  • cwrappers-fuzzy

Quick Start

Finder only:

cwrappers-finder \
  --compile-commands /path/to/compile_commands.json \
  --out wrappers.csv

Fuzzy scoring only:

cwrappers-fuzzy wrappers.csv

Combined pipeline:

cwrappers pipeline \
  --compile-commands /path/to/compile_commands.json \
  --out wrappers.csv \
  --fuzzy

Callgraph-only export:

cwrappers-finder \
  --compile-commands /path/to/compile_commands.json \
  --callgraph-only \
  --callgraph-out /path/to/callgraph_out

Single-function raw edge evidence export:

cwrappers-finder \
  --compile-commands /path/to/compile_commands.json \
  --edge-evidence target_function \
  --out target_function_edges.csv

--callgraph-only writes:

  • callgraph_edges.csv: raw edge rows, including caller_in_project / callee_in_project
  • call_counts.csv: project-only per-callee incoming aggregates for project-defined callees
  • function_fan_summary.csv: project-only per-function fan_in / fan_out summary, while still reflecting external callers/callees on those project rows
  • translation_units.csv: per-translation-unit parse diagnostics and exported-edge counts

Catalog YAML

cwrappers ships with a bundled default catalog at cwrappers/data/categorized_methods.yaml.

  • cwrappers-finder uses it automatically when --yaml is not provided.
  • cwrappers-fuzzy uses it automatically when --yaml is not provided.
  • You can always override with --yaml /path/to/custom.yaml.

Command Overview

Unified CLI:

cwrappers --help
cwrappers finder --help
cwrappers fuzzy --help
cwrappers pipeline --help

Direct subtool CLIs:

cwrappers-finder --help
cwrappers-fuzzy --help

Requirements

  • Python 3.9+
  • Clang/libclang available in your environment
  • A valid compile_commands.json (for finder/pipeline)

Project Layout

This repository uses a flat layout for packaging:

pyproject.toml
README.md
cwrappers/
  __init__.py
  cli.py
  data/
  finder/
  fuzzy/
  shared/

License

MIT

About

Python CLI toolkit for finding C wrapper functions. Developed as part of a research project evaluating the reliability of LLM generated patches intended for large open-source repositories.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages