Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 5, 2025

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Create a new GitHub repository called codeql-tracing-playground with a sample C++ project designed to test and explore CodeQL's build tracing behavior. The project should be buildable with a simple make command and include several files and scenarios that exercise different aspects of how tracing works.

Project Structure

Create the following structure:

codeql-tracing-playground/
├── README.md
├── Makefile
├── src/
│   ├── main.cpp
│   ├── utils.cpp
│   ├── utils.h
│   ├── math_ops.cpp
│   ├── math_ops.h
│   └── generated/        # For dynamically generated code
├── scripts/
│   └── generate_config.sh  # Script that generates a header file during build
└── . gitignore

Requirements

1. Multiple compilation units: The project should have at least 3-4 . cpp files that get compiled separately and linked together, so we can see multiple compiler invocations being traced.

2. Generated code during build: Include a shell script (scripts/generate_config.sh) that the Makefile calls during the build to generate a header file (src/generated/config.h) containing build timestamp or version info. This tests whether tracing correctly handles code that doesn't exist until build time.

3. Conditional compilation: Use some #ifdef preprocessor directives that are controlled by -D flags passed in the Makefile (e.g., DEBUG_MODE). This helps verify that the tracer captures the actual flags used.

4. Simple function calls across files: Have main.cpp call functions from both utils.cpp and math_ops.cpp so we can see cross-file references in the resulting database.

5. A recursive function: Include at least one recursive function (perhaps a factorial or fibonacci in math_ops.cpp) - useful for later testing dataflow analysis.

6. Makefile features:

  • Separate compilation and linking steps (not just one big compile command)
  • A clean target
  • A DEBUG=1 option that adds -g and -DDEBUG_MODE flags
  • Phony targets for the generated code step

7. README. md: Include instructions for:

  • Building normally (make)
  • Building with debug flags (make DEBUG=1)
  • Cleaning (make clean)
  • A section on how to create a CodeQL database from this project

Code Content Ideas

  • utils.cpp: String manipulation helpers, maybe a simple logging function that behaves differently based on DEBUG_MODE
  • math_ops.cpp: Basic math operations including the recursive function, perhaps some pointer arithmetic to make things interesting for analysis
  • main.cpp: Ties everything together, reads the generated config, calls functions from other modules

. gitignore

Should ignore:

  • Built objects (*.o, the final binary)
  • The generated header file (src/generated/config.h)
  • Any CodeQL database directories (*-db/, *. dbscheme)

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI requested a review from miketsprague December 5, 2025 17:09
@miketsprague miketsprague deleted the copilot/add-codeql-tracing-playground branch December 8, 2025 10:23
@miketsprague miketsprague restored the copilot/add-codeql-tracing-playground branch December 8, 2025 10:23
@miketsprague miketsprague deleted the copilot/add-codeql-tracing-playground branch December 8, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants