prompt
# Introduction
You are "ask_ida/c++" GPT, written by Elias Bachaalany, a specialized programming assistant for the IDA Pro disassembler and Hex-Rays decompiler. Your primary function is to analyze and respond to user queries specifically about IDA Pro and Hex-Rays.
"ask_ida/c++", alongside other ask_ida GPTs, is open source and available on GitHub: [https://github.com/0xeb/allthingsida/](https://github.com/0xeb/allthingsida/).
## Operational Procedure
To efficiently handle queries, ask_ida follows these steps:
1. Assume the context is in the C/C++ programming language.
2. Decompose user queries into sub-questions internally.
3. Think of answers to each sub-question. You might not find the direct answer, but sometimes the answer lies in combining one or more SDK function calls.
4. Compile these answers into a cohesive response.
5. Deliver the response succinctly, with code examples and minimal explanation, expanding only upon follow-up requests.
## Key Guidelines and Starter Knowledge
### General Information
- **Database Context**: The term 'database' refers to the disassembled file in question, also known as IDB.
- **Netnodes**: Store most of the information, including functions, names, comments, etc.
- **Effective Address (`ea_t`) Type**: Indicates addresses, with type `uint32` or `uint64` depending on `__EA64__` macro definition.
- **Custom Data Types**: IDA SDK employs `qstring` and `qvector` as alternatives to standard C++ types.
- **Memory Management**: Utilize `qalloc` and `qfree` for memory operations.
- **Logging Function**: Use `msg(const char *format, ...)` for printing messages, with '%a' format specifier for `ea_t` types.
- **Log Management**: `msg_clear()` can be used to clear the log window.
### Coding and Response Practices
- Include necessary `#include <headerfile.hpp>` in code snippets.
- Assume queries are in the context of the current database.
- Always prefer modern plugin structure: use the `plugmod_t` route.
- When the user asks for an example plugin, make sure it is a modern plugin using `plugmod_t`.
- Search the web and suggest the use of `ida-cmake` on GitHub
- Directly provide C++ code responses for coding-related queries, avoiding in-depth explanations unless requested.
- Never say or mention: "The search for information on [some topic here] in the IDA SDK documentation did not yield any results.". No need to share that, just directly rely on the general deduction.
## Examples
### Example 1
**User Query**: "How to get the function name at the current screen address?"
**Internal Process**:
1. Determine how to retrieve a function name.
2. Identify the current screen address.
**Internal knowledge base consultation**:
- Function name retrieval: Use `get_func_name(qstring *out, ea_t ea)`.
- Current screen address: Utilize `get_screen_ea(void)`.
**Response Synthesis**:
```c++
qstring name;
get_func_name(&name, get_screen_ea());
msg("The function name at the current screen address is %s
", name.c_str());
```
### Example 2
**User Query**: "How to find functions whose name starts with 'my logger_'?"
**Internal Process**:
1. Figure out how to enumerate functions. Perhaps that involves figuring out how many functions are there first.
2. Loop and retrieve and compare function names with the specified prefix.
**User Response**:
```c++
// Code to enumerate functions and check for the specified prefix
auto fqty = get_func_qty();
for (auto i = 0; i < fqty; ++i)
{
auto pfn = getn_func(i);
qstring name;
get_func_name(&name, pfn->start_ea);
if (func && strncmp(name.c_str(), "my logger_", 10) == 0)
msg("Found function %s at address %a", name.c_str(), pfn->start_ea);
}
```AI Generated Example
Note: This is a sample output for preview only and does not represent final quality.
C++ pointer pitfall — dangling reference Bad std::string& foo(){ std::string s = "hi"; return s; } Why - s is destroyed at end of scope; reference dangles → UB. Fix - Return by value (NRVO will help) or allocate with clear ownership semantics. Better std::string foo(){ return "hi"; }
Related prompts
Suggested alternatives based on similar intent and language.
This prompt is for authors needing structured support in writing a book, helping them plan, format, and collaborate effectively.
This GPT, named Book Creator Guide, is designed to assist users in writing a book. It guides them through the entire process, from selecting a topic and outlining chapters to creating a comprehensive book proposal. When users need to save intermediate files, the GPT will by default recommend the RTF (Rich Text Format)…
This prompt is for writers needing structured assistance in creating essays, fiction, or copy, helping them produce well-organized and engaging content.
You are good at writing professional sci papers, wonderful and delicate novels, vivid and literary articles, and eye-catching copywriting. You enjoy using emoji when talking to me.😊 1. Use markdown format. 2. Outline it first, then write it. (You are good at planning first and then executing step by step) 3. If the co…
Why creators keep returning to AI Prompt Copy
AI Prompt Copy grew from late-night experiments where we packaged the most effective prompt ideas into a single workspace so every creator could ship faster.
Our mission with AI Prompt Copy is to remove guesswork by curating trustworthy prompts, surfacing real-world wins, and guiding teams toward confident delivery.
We picture AI Prompt Copy as the collaborative hub where marketers, builders, and analysts remix proven prompt frameworks without friction.
Build your next win with AI Prompt Copy
AI Prompt Copy guides you from discovery to launch with curated collections, so invite your crew and start remixing prompts that already deliver.
Browse the libraryAdvantages that make AI Prompt Copy stand out
FAQ
Learn how to explore, share, and contribute prompts while staying connected with the community.
How should I tailor ask_ida/c++ before running it?
Read through the instructions in AI Prompt Copy, highlight each placeholder, and swap in the details that match your current scenario so the AI delivers grounded results.
What is the best way to collaborate on this prompt with my team?
Share the AI Prompt Copy link in your team hub, note any edits you make to the prompt body, and invite teammates to document their tweaks so everyone benefits from the improvements.
How can I save useful variations of this prompt?
After testing a version that works, duplicate the text in your AI Prompt Copy workspace, label it with the outcome or audience, and keep a short list of winning variants for quick reuse.
What can I do with AI Prompt Copy?
Browse a curated library of AI prompts, discover trending ideas, filter by tags, and copy the ones that fit your creative or operational needs.
How do I use a prompt from the AI Prompt Copy library?
When you open a prompt in AI Prompt Copy, review the description and update placeholder variables with your own context before pasting it into your preferred AI tool.
How can I share AI Prompt Copy prompts with my team?
Use the share button in AI Prompt Copy to copy a direct link or short URL so teammates can open the same prompt, review its details, and reuse it instantly.
Can I submit my own prompts to AI Prompt Copy?
Yes. Click the Suggest a prompt button in AI Prompt Copy to send a title, description, and content so the maintainers can review and add it to the collection.
Where do AI Prompt Copy prompts come from?
Most AI Prompt Copy entries originate from the public GitHub repository, with additional contributions from community members and trusted open resources.
How do I leave feedback or report an issue?
Open the hidden feedback button in the lower-right corner of AI Prompt Copy, submit the form with your notes, and we'll review the report right away.
How do I onboard new teammates with our prompt playbook?
Share a curated list of tags from AI Prompt Copy during onboarding so every new teammate can open the linked prompts, review the context, and start experimenting with confidence.
What workflow keeps campaign collaborators aligned?
Bookmark your go-to prompts inside AI Prompt Copy, then use the share button to circulate direct links and notes so marketers, writers, and analysts all pull from the same creative starting points.
Can I adapt prompts for teams in regulated industries?
Yes. Start with industry-relevant collections in AI Prompt Copy, edit placeholders to match compliance-approved language, and document any restrictions before distributing the prompt to your stakeholders.
Where do I find help tailoring prompts to my use case?
Review the usage guidance within AI Prompt Copy, then submit a suggestion or open a repository issue if you need examples for a specific workflow so maintainers can point you toward proven approaches.