{"id":27928527,"url":"https://github.com/gitteja19/basic-c-debbuger","last_synced_at":"2025-06-25T19:33:23.780Z","repository":{"id":291388031,"uuid":"977464442","full_name":"gitteja19/Basic-C-Debbuger","owner":"gitteja19","description":"Linux - mini project.","archived":false,"fork":false,"pushed_at":"2025-05-04T09:16:55.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T02:41:55.559Z","etag":null,"topics":["c","linux-shell","signal-handling","system-calls"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitteja19.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-04T09:16:54.000Z","updated_at":"2025-05-04T09:38:18.000Z","dependencies_parsed_at":"2025-05-04T10:35:03.368Z","dependency_job_id":"f348b942-5066-47c2-b2c0-7115bb370cae","html_url":"https://github.com/gitteja19/Basic-C-Debbuger","commit_stats":null,"previous_names":["gitteja19/basic-c-debbuger"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gitteja19/Basic-C-Debbuger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitteja19%2FBasic-C-Debbuger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitteja19%2FBasic-C-Debbuger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitteja19%2FBasic-C-Debbuger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitteja19%2FBasic-C-Debbuger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitteja19","download_url":"https://codeload.github.com/gitteja19/Basic-C-Debbuger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitteja19%2FBasic-C-Debbuger/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261941026,"owners_count":23233666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","linux-shell","signal-handling","system-calls"],"created_at":"2025-05-07T02:40:17.458Z","updated_at":"2025-06-25T19:33:23.762Z","avatar_url":"https://github.com/gitteja19.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🐞 my_gdb – A Minimal Signal-Based Debugger in C\n\n`my_gdb` is a command-line mini-debugger for C programs, built from scratch using **Linux signals**, **process forking**, and **runtime code instrumentation**. It mimics GDB-like behavior for stepping through `main()` line-by-line using keyboard commands.\n\n\u003e 🎯 Ideal for students and system programmers learning **signal handling**, **process control**, and **basic debugging internals**.\n\n---\n\n## 🔧 Features\n\n- 🧠 **Custom signal handlers** to pause/resume execution\n- 🔀 **Fork-based process control** for parent-child interaction\n- ⏸️ **Line-by-line stepping** using inserted `pause()` calls\n- 🧼 **Preprocessing** and filtering via `gcc -E` and `grep`\n- 🎨 **Color-coded terminal UI** using ANSI escape codes\n- 🧾 Simple debugger interface: `(r)un`, `(n)ext`, `(q)uit`\n\n---\n\n## 🛠️ How It Works\n\n1. Parses the given `.c` file.\n2. Rewrites it:\n   - Inserts signal handlers.\n   - Adds `pause()` after every line inside `main()`.\n3. Compiles and forks:\n   - Child runs the modified binary.\n   - Parent controls execution via **SIGUSR1**.\n\n---\n\n## 🧪 Example Usage\n\n```bash\n$ ./my_gdb test.c\n\nuse:./my_gdb \u003cfile.c\u003e\npress (r)un to start,(q)uit\n\n(my_gdb) : r\nRunning gdb\ngdb:4321, temp:4322\n***** MY GDB BASIC *****\n(n)ext line, (q)uit\n\nline-nn  : x = 10;\n(my_gdb) : n\nline-nn  : y = x + 5;\n```\n\n---\n## 📚 Files\n```bash\nmy_gdb/\n├── my_gdb.c         # Source code\n├── test.c           # Sample program to debug\n├── prog.c           # Instrumented source\n├── prog.i           # Preprocessed file\n├── temp.i           # Final file with pause() inserted\n```\n---\n## 📚 Concepts Used\n\n- Linux Signals: `SIGUSR1`, `SIGUSR2`, `SIGKILL`, `pause()`\n- Process Creation: `fork()`, `execl()`, `kill()`\n- File I/O and parsing: `fopen()`, `fgets()`, `fputs()`\n- ANSI Escape Sequences for color terminal output\n- GCC Preprocessing: `gcc -E`\n- Input Flushing: `__fpurge(stdin)`\n\n---\n\n## 💡 Educational Value\n\n- Helps understand how debuggers work behind the scenes.\n- Excellent mini-project for **OS**, **System Programming**, or **Debugging Tools** coursework.\n- Demonstrates practical use of signals, forks, and inter-process control.\n\n---\n\n## 🧑‍💻 Author\n\nTej, B.Tech in Electrical Engineering  \nFocused on Embedded Systems, Linux Internals \u0026 C Systems Programming  \n🇮🇳 India\n\n---\n\n## 📝 License\n\nMIT License – feel free to learn and build on this project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitteja19%2Fbasic-c-debbuger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitteja19%2Fbasic-c-debbuger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitteja19%2Fbasic-c-debbuger/lists"}