Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Requirement to Run/Debug in a Windows Console
Requirement to Run/Debug in a Windows Console [message #524285] Wed, 31 March 2010 08:22 Go to next message
Eclipse UserFriend
I've seen this question asked by others but not directly answered, and I've searched the forums, Google, and Bing until I'm blue in the face.

A year or so ago I performed an "emergency" port of an old DOS application, that runs a crucial part of our business, to a Windows console application. I used CDT+MinGW and had great success. The application used direct framebuffer access to draw/update the screen, and managed cursor positioning, as was common in the day. I replaced those direct screen/cursor DOS calls with Win32 API Console functions that updated the screen/cursor in the same fashion.

Now I'm revisiting this code to do some tweaks (and yes we intend to rewrite as a GUI at some point, but priorities right now demand we keep this one running), but I'm having an issue with debugging. I just *know* when I initially did this conversion, that I used to debug this code in CDT while it ran in an external console (cmd.exe). It isn't possible to do so within the Eclipse console because of the full screen framebuffer/cursor manipulation required.

Thing is, I've since updated to Windows 7 Pro 64-bit and reinstalled Eclipse 3.5+CDT 6 with the latest TDM build of MinGW. Opening the same project, I cannot for the life of me get it to launch/debug in a Windows console -- it runs "invisible", apparently grabbed by the Eclipse console, and I see nothing since the app doesn't use stdin/out IO. I must have had this working before, as I distinctly remember debugging within CDT and it would have been impossible to do so with the Eclipse console given the nature of the app. Why won't the same project work the same now? I'd prefer to debug within CDT obviously, as opposed to running gdb directly from the console.

I've tried all sorts of Debug Launch configuration options with no luck. I'll probably feel stupid that it's something obvious, but at this point I'm feeling pretty stupid anyway, so all guidance is appreciated.
Re: Requirement to Run/Debug in a Windows Console [message #528425 is a reply to message #524285] Tue, 20 April 2010 09:30 Go to previous messageGo to next message
Eclipse UserFriend
Bump?
Re: Requirement to Run/Debug in a Windows Console [message #528780 is a reply to message #524285] Wed, 21 April 2010 13:58 Go to previous messageGo to next message
Eclipse UserFriend
Yes, this is a big issue IMO on Windows and I've been militating to simply use cmd.exe always or at least have the option. There are several bugs opened that are a consequence of not using cmd, I'll post them when I get the chance. I'd try to fix the problem myself but I'll be very busy for a couple of weeks.

You could try with the new EDC debugger which is optional in CDT 7.0

1. Get Eclipse 3.6 M6 (not the C/C++ package)
http://download.eclipse.org/eclipse/downloads/

2. Get CDT 7.0 nightly build
http://download.eclipse.org/tools/cdt/builds/7.0.0/index.htm l

3. Install CDT with CDT Dev Tools and EDC

4. Create a Debug configuration for your project. In your debug configuration page, click on the "select other..." link and select EDC for Windows.

Keep in mind this debugger is very much a work in progress.
Re: Requirement to Run/Debug in a Windows Console [message #529397 is a reply to message #528780] Sat, 24 April 2010 13:07 Go to previous messageGo to next message
Eclipse UserFriend
Marc-Andre,

Thanks, this seems to have done the trick with a basic Hello World app I whipped together at home today. Next week at work I'll try with the app I posted about.

But from what you're saying, I take it this has never been possible before? Man, I must really be losing my mind then, because I distinctly remember stepping through this code with CDT/GDB in the past, but that would have been impossible without running in the cmd.exe window. Maybe I attached to the running process, but that doesn't seem right either -- this was the first MinGW/CDT work I had done, and I remember launching in debug and stopping at main upon entry, which wouldn't be possible by running then attaching.

Anyway, I agree this is critical functionality. If it's never been there, then it needs to be or else MinGW/CDT will be difficult to use as an IDE for any but the most basic of console development. Hopefully the release of 3.6+CDT7 will fully address this issue.
Re: Requirement to Run/Debug in a Windows Console [message #529957 is a reply to message #529397] Tue, 27 April 2010 16:21 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

I'm still struggling with this same problem. I'm new to CDT, so it' most likely a screw up on my part.

Step 4 above says "Create a Debug configuration for your project. In your debug configuration page, click on the "select other..." link and select EDC for Windows."

I'm assuming this means changing the "Select Preferred Launcher". I don't have an option for EDC for Windows. I only have GDB(DSF) Remote System Process Launcher
GDB(DSF) Create Process Launcher
Standard Create Process Launcher

This tells me that the EDC portion of CDT did not install correctly.
I checked the Installation Details Error log and found the following error:

!ENTRY org.eclipse.update.configurator 4 0 2010-04-27 15:48:33.558
!MESSAGE Unable to find feature.xml in directory: D:\eclipse\features\org.eclipse.cdt.debug.edc_1.0.0.20100416 0805.jar

I checked the jar and there is a feature.xml in the jar.

I'm using Eclipse 3.6.0 and CDT 7.0.0.201003151310 and MinGW 5.1.6 on Windows.

Any input would be appreciated.
Re: Requirement to Run/Debug in a Windows Console [message #529960 is a reply to message #529957] Tue, 27 April 2010 16:32 Go to previous messageGo to next message
Eclipse UserFriend
Hello Adrian,

I'm not sure what's wrong. You said you have CDT 7.0.0.201003151310 but the error mentions 201004160805. How did you install CDT and EDC? Did you install everything from the same CDT nightly build, separately from Eclipse (i.e. not the Eclipse IDE for C/C++ package)?
Re: Requirement to Run/Debug in a Windows Console [message #529981 is a reply to message #529960] Tue, 27 April 2010 17:42 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for such a quick reply.

I started by deleting my existing eclipse directory to make sure there were no conflicts.
I downloaded and unzipped Eclipse 3.6M6 for Win32 (eclipse-SDK-3.6M6-win32.zip)
I then downloaded the latest nightly build for CDT (cdt-master-7.0.0-I201004160805.zip) and unzipped this into my eclipse directory.

I didn't see a specific option for EDC, but did see the jar files included in the zip.

I double checked the versions numbers and don't know why the install logs say 1 version # and the install file I used says another.

I think the problem is that the console window is not coming up. I have a very basic program that asks for user input. I pasted it below. The debug is waiting at the cin for the user input, but the console window never displays so there is never any input.

int main()
{
string yourName;

cout << "Enter your name: ";
cin >> yourName;
cout << "Hello " + yourName << endl;

return 0;
}

Thanks again.
Re: Requirement to Run/Debug in a Windows Console [message #529984 is a reply to message #529981] Tue, 27 April 2010 18:07 Go to previous messageGo to next message
Eclipse UserFriend
Adrian wrote on Tue, 27 April 2010 17:42
Thanks for such a quick reply.
I then downloaded the latest nightly build for CDT (cdt-master-7.0.0-I201004160805.zip) and unzipped this into my eclipse directory.
I didn't see a specific option for EDC, but did see the jar files included in the zip.


Unzipping is not the preferred way, it can lead to problems.
Try to do it in Eclipse. Follow the instructions here;
http://download.eclipse.org/tools/cdt/builds/7.0.0/I.I201004 271351/index.html

Basically, you have to add the zip to the list of update site, then select this update site and you will be able to check CDT and EDC in optional features.
Re: Requirement to Run/Debug in a Windows Console [message #529989 is a reply to message #529984] Tue, 27 April 2010 19:06 Go to previous messageGo to next message
Eclipse UserFriend
Well that cleared up a bunch of errors. It look like I'm having 1 more problem with it though.

In CDT Main Features I only installed the Development Tools, not the SDK.

In Optional Features I installed
CDT GNU Toolchain Build Support
CDT GNU Toolchain Debug Support
CDT Utilities
Eclipse C/C++ Development Platform
Eclipse C/C++ DSF gdb Debugger Integration
Eclipse CDT p2 Toolchain Installer
Eclipse Debugger for C/C++

In the Debug perspective, in the Debug Configuration I changed the Preferred Launcher to EDC Create Process (windows) Launcher.

Now when I debug, the console window appears but it doesn't step through the code (I've setup 2 break points in the main).

I get an error
No source available for "[HelloWorld.exe] at 0x4012d0"

The project successfully compiles and runs in a Run Configuration.

Thanks again for your help.
Re: Requirement to Run/Debug in a Windows Console [message #529991 is a reply to message #529989] Tue, 27 April 2010 19:30 Go to previous messageGo to next message
Eclipse UserFriend
Adrian wrote on Tue, 27 April 2010 19:06

Now when I debug, the console window appears but it doesn't step through the code (I've setup 2 break points in the main).


You're nearly there Smile

This is probably a debug info problem. EDC only supports dwarf2 debug info, I think MinGW generates stabs by default so you have to specify that you want dwarf2 in the compiler arguments. I assume you have a Managed project (i.e. you don't write Makefiles yourself). To add the argument, open your project properties, C/C++ Build, Settings, Tool Settings (tab), under GCC C++ compiler go to Debugging. In Other debugging flags, add -gdwarf-2

There is a bug opened about this:

Debugger should prompt when main executable has no recognizable debug info
https://bugs.eclipse.org/bugs/show_bug.cgi?id=295387
icon14.gif  Re: Requirement to Run/Debug in a Windows Console [message #529994 is a reply to message #529991] Tue, 27 April 2010 20:57 Go to previous message
Eclipse UserFriend
That was it.
Terrific. Very Happy

Well at least (most of) the problems I was having were related to bugs Wink

I really do appreciate your help. I'm traditionally a Java coder and I'm just now trying to ramp up on C/C++. I don't think I would of figured this out without your help.

Adrian
Previous Topic:launch failed. Binary not found
Next Topic:Project Build Questions
Goto Forum:
  


Current Time: Tue Jun 17 08:25:30 EDT 2025

Powered by FUDForum. Page generated in 0.11812 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top