Logo

dev-resources.site

for different kinds of informations.

C debugger Not able to Print or take Input when in debugger mode is On

Published at
11/7/2024
Categories
vscode
c
debugging
Author
adityanp1
Categories
3 categories in total
vscode
open
c
open
debugging
open
Author
9 person written this
adityanp1
open
C debugger Not able to Print or take Input when in debugger mode is On

in .vscode Folder :

My lanch.json:

    "configurations": [
        {
            "name": "C/C++: gcc.exe build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: gcc.exe build active file"
        }
    ],
    "version": "2.0.0"
}
Enter fullscreen mode Exit fullscreen mode

task.json :


{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc.exe build active file",
            "command": "C:\\MinGW\\bin\\gcc.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}
Enter fullscreen mode Exit fullscreen mode

c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.22621.0",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64",
            "compilerPath": "C:/MinGW/bin/gcc.exe"
        }
    ],
    "version": 4
}
Enter fullscreen mode Exit fullscreen mode

Vs Code Image

code :

#include <stdio.h>
int main(){
int i;
scanf("%d", &i);
printf("You entered: %d\n", i);
return 0;
}
Enter fullscreen mode Exit fullscreen mode

Terminal:

PS C:\Users*\OneDrive\Documents\INTERVIEW PREP\DSA and Small Learnings> & 'c:\Users**.vscode\extensions\ms-vscode.cpptools-1.23.0-win32-x64\debugAdapters\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-caznmueg.sx2' '--stdout=Microsoft-MIEngine-Out-kpfaclzx.m3o' '--stderr=Microsoft-MIEngine-Error-nq1rgwan.vxy' '--pid=Microsoft-MIEngine-Pid-d12jsuyv.lf0' '--dbgExe=C:\MinGW\bin\gdb.exe' '--interpreter=mi'

When I press F5, means i debug my C code, it not prints anything or neither take any inputs if scanf is there, if debugger is at scanf , and if i press F10 , then as shown in picture, Nothing happens. I can Only hover and see the variable value. I have installed


 set up,

 ```codeLLB```

 and code runner extensions, as well.

Also, If I not put debugger at scanf function: it waits for input ,but when i write something and hit enter, nothing happens, also the debugger not allow to step next step...And after that if i stop the debugger, then what ever i wrote in terminal ,shows there immediately. Example: if i wrote fffff and then stop debugger then that word executes in terminal!
Enter fullscreen mode Exit fullscreen mode
debugging Article's
30 articles in total
Favicon
Unlocking the Power of Chrome DevTools Snippets
Favicon
Tracing a method call in Ruby
Favicon
Troubleshooting Docker credsStore Auto-Configuration Issues in VS Code Dev Containers
Favicon
Replay failed stripe events via webhook
Favicon
Mastering Debugging in C++: Techniques, Tools, and Best Practices for Developers
Favicon
What Building๐Ÿ’ป a WebGL App Taught Me About Debugging
Favicon
Debugging with git bisect: A Smarter Approach to Bug Localization
Favicon
Comprehensive Guide to Python Debugging Tools for Efficient Code Troubleshooting
Favicon
Best Mobile Crash Reporting Tools for 2025: Features, Pros, and Cons
Favicon
Automating API Testing with Postman CLI: Advanced Capabilities and New Alternatives
Favicon
Mastering JSON to Tabular Conversion: A Comprehensive Guide
Favicon
Transform Your API Logs Into Interactive Visualizations with This Free Online Tool
Favicon
Debugging Kubernetes cluster part 2
Favicon
C debugger Not able to Print or take Input when in debugger mode is On
Favicon
Debugging Time: A Developer's Best Friend (Seriously!)
Favicon
The Art of Problem-Solving
Favicon
Top Express.js Mistakes and How to Fix Them
Favicon
Decoding URL Encoding: Unveiling the Mystery Behind % Symbols
Favicon
Debugging Techniques Every Developer Should Know
Favicon
The Power of Pause: Transforming Debug Sessions into Success Stories
Favicon
Understanding โ€œFailed to Fetchโ€ JavaScript Errors and How to Fix Them
Favicon
The Future of Programming with AI - Part 2: AI-Powered Code Editing
Favicon
Swift Logging Techniques: A Complete Guide to iOS Logging
Favicon
The Ultimate Guide to Debugging Complex Bugs: Tools and Techniques for Developers
Favicon
Fixing the Postman 405 Method Not Allowed Error
Favicon
Debugging Distributed Systems
Favicon
Browser request interceptor
Favicon
Debugging Kubernetes Deployments
Favicon
Debugging Smart Contracts on the Ethereum Network
Favicon
Debugging and Error Handling in Express.js Applications

Featured ones: