Bug 305206 - Assertion failed while debugging shared library under Windows
Summary: Assertion failed while debugging shared library under Windows
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 0 DD 1.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: cdt-debug-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-09 13:00 EST by Cilyan Olowen CLA
Modified: 2020-09-04 15:21 EDT (History)
4 users (show)

See Also:


Attachments
The complete input/output log when failing (For version 7.0.1) (2.60 KB, text/plain)
2010-03-09 13:02 EST, Cilyan Olowen CLA
no flags Details
Eclipse log when using GDB (DSF) (3.08 KB, text/plain)
2010-03-17 05:45 EDT, Cilyan Olowen CLA
no flags Details
Source of a project triggering the bug (13.77 KB, application/zip)
2010-04-20 04:03 EDT, Cilyan Olowen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cilyan Olowen CLA 2010-03-09 13:00:55 EST
Build Identifier: 20100218-1602

I currently use Eclipse C/C++ Development Tooling undex Windows XP SP2.
To compile and debug, I installed MinGW and MSYS. MinGW version is 5.1.6 but I
use GCC version 4.4.0 provided by MinGW. I also installed GDB 7.0.1 from the
MinGW website and libexpat-1.dll.
I programmed a simple C++ shared library together with a simple caller program
also written in C++. Compilation and linking is alright under Windows (I also
tried under Linux) and I can debug both caller and library from the Windows
command line.
The problem arise when trying to debug from Eclipse CDT using MI under Windows
(same operation under Linux is OK). gdb is launched with several commands but as
soon as -exec-run is issued, gdb stops with the message :

../../gdb-7.0.1/gdb/thread.c:79: internal-error: inferior_thread: Assertion `tp'
failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

I then tried to paste the extact same commands in command line using "gdb
--interpreter=mi program.exe" and everything runs fine. I have no problem
debugging a single program or a program with statically linked library inside.

Bug also reported at GDB : http://sourceware.org/bugzilla/show_bug.cgi?id=11362

Reproducible: Always

Steps to Reproduce:
1. Shared library
2. Under Windows
3. Using GDB (MI interpreter, whatever command set is used)
Comment 1 Cilyan Olowen CLA 2010-03-09 13:02:12 EST
Created attachment 161492 [details]
The complete input/output log when failing (For version 7.0.1)
Comment 2 Marc Khouzam CLA 2010-03-12 10:57:19 EST
I'm not sure what is happening, but you could try using the other CDT debugger: DSF-GDB.  In the main tab, when you launch, there is a hyperlink at the bottom.  Click on it and select the GDB (DSF) debugger and try it out.
Comment 3 Cilyan Olowen CLA 2010-03-17 05:44:41 EDT
Unfortunately, I have the same error with DSF:

[New Thread 1140.0x1a0]
gdb: unknown target exception 0xc0000135 at 0x7c974ed1
../../gdb-7.0.1/gdb/thread.c:79: internal-error: inferior_thread: Assertion `tp' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) [answered Y; input not from terminal]
../../gdb-7.0.1/gdb/thread.c:79: internal-error: inferior_thread: Assertion `tp' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) [answered Y; input not from terminal]

But I can't find the core dump ? Maybe this would help you.
Comment 4 Cilyan Olowen CLA 2010-03-17 05:45:44 EDT
Created attachment 162253 [details]
Eclipse log when using GDB (DSF)
Comment 5 Marc-André Laperle CLA 2010-04-06 00:39:11 EDT
I had the exact same error and it turns out the executable couldn't find my dll so I copied it to the executable working directory and it worked. Does the executable work if you run it (not debug) from Eclipse? If it terminates immediately then a dll is probably missing (see bug 207183).

I can also reproduce this outside Eclipse, in Command Prompt. You said you could debug from the command line, are you sure you debugged from the same working dir as Eclipse? For example, if you had

project/Debug/myexe.exe
project/Debug/mydll.dll

and debugged from the project/Debug directory than it would work from command line. But in Eclipse, the default working dir would be project/ and it wouldn't work.

My steps to reproduce (inside or outside Eclipse):
1. Create a dll with a simple function
2. Create an executable calling the function in the dll (link with the dll)
3. Launch MinGW gdb 7.0.1 without the dll available in the working dir or in PATH
4. Start debugging the executable
Comment 6 Cilyan Olowen CLA 2010-04-06 03:46:10 EDT
(In reply to comment #5)

Of course, PATH is set correctly and executable runs fine, either from Eclipse or from console. Usually, if a dll is missing and the executable is run outside froim eclipse, a message box appears to inform that the dll was not found.
Comment 7 Marc-André Laperle CLA 2010-04-16 19:20:03 EDT
Would it be possible to attach a small test project(s?) that triggers the bug? Thanks!
Comment 8 Cilyan Olowen CLA 2010-04-20 04:03:18 EDT
Created attachment 165389 [details]
Source of a project triggering the bug

The archive is constituted of two components : a Dll lib and an exe program. This program compiles, runs and debugs well under Linux unmodified.