gdb 7.8 consistently fails to run executable - error is "dll path too long"

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

gdb 7.8 consistently fails to run executable - error is "dll path too long"

DGStevens
I'm unable to use gdb on any c/c++ executables.  When I try, gdb issues the message "dll path too long" and fails to start the target executable.

I know that I must be doing something stupid, but it's escaping me.  The only forum discussion that I could find suggested using mintty, which I am.  I did see mention of a known bug in gdb, but no suggested workarounds, other than running in mintty.

The following test case is the simplest that I could manage.  I see the same failure with both 'C' and C++ files (gcc and g++, respectively).

I'm running Win7, with the old 32-bit cygwin.  cygcheck.txt should be attached.

$> cat gdbtst.c
#include <stdio.h>

int main(int argc, char *argv[]) {
  printf("Hello World!\n");
}

$> gcc --version
gcc (GCC) 4.8.3
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$> gcc -g gdbtst.c -o gdbtst.exe
$> gdbtst.exe
Hello World!
$> gdb gdbtst.exe
GNU gdb (GDB) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from gdbtst.exe...done.
(gdb) break main
Breakpoint 1 at 0x4011be: file gdbtst.c, line 4.
(gdb) step
The program is not being run.
(gdb) run
Starting program: /home/Deans/SBX/Samples/gdbtst.exe
[New Thread 34472.0x8ad8]
dll path too long
(gdb) step
Cannot execute this command while the selected thread is running.
(gdb) quit
A debugging session is active.

        Inferior 1 [process 34472] will be killed.

Quit anyway? (y or n) y
$> cygcheck -s -v -r >cygcheck.txt

cygcheck.txt
Reply | Threaded
Open this post in threaded view
|

Re: gdb 7.8 consistently fails to run executable - error is

ASSI
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: gdb 7.8 consistently fails to run executable - error is

DGStevens
Hi Achim-

Thanks.  Unfortunately, the change didn't seem to help regarding my issue with GDB.  I don't know if it matters, but I fired up an old computer running XP.  I updated all of the Cygwin software, and tried the same test.  It worked fine on XP, but it seems to fail on Win7, at least for me.

FWIW, I tried manually trimming the path to just:

$> echo $PATH
.:/home/Deans/bin:/usr/local/bin:/usr/bin

...

$> cygcheck -s

Cygwin Configuration Diagnostics
Current System Time: Fri Aug 22 00:02:07 2014

Windows 7 Professional Ver 6.1 Build 7601 Service Pack 1

Running under WOW64 on AMD64

Path:   .
        C:\cygwin\home\Deans\bin
        C:\cygwin\usr\local\bin
        C:\cygwin\bin
...
Reply | Threaded
Open this post in threaded view
|

Re: gdb 7.8 consistently fails to run executable - error is

Dominik Straßer
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: gdb 7.8 consistently fails to run executable - error is

Dominik Straßer
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: gdb 7.8 consistently fails to run executable - error is

Corinna Vinschen-2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: gdb 7.8 consistently fails to run executable - error is

Dominik Straßer
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: gdb 7.8 consistently fails to run executable - error is

Tim Chick
> Am 08.10.2014 um 14:12 schrieb Corinna Vinschen:
>> On Sep 29 14:13, Dominik Straßer wrote:
>>> Hi all,
> Hi Corinna,
>
>>> I've dug into the gdb sources. The problem is in the cygwin-only
>>> part and is not about the PATH variable but about one single DLL
>>> file name.
>>>
>>> This path length is *fixed* to 512 characters
>>> (SO_NAME_MAX_PATH_SIZE) for the *realpath* of the DLL.
>>
<SNIP>
>>
>> I'm not sure how to fix this problem yet.  I'll look into it when I
>> had a chance to catch up with my insane mail backlog.
> I only see a chance by makin this a dynamic storage.
> as indicated in solist.h

Dear All,

I experienced the same problem.

The error will occur if the path of the dll is too long, OR if gdb can not access the dll for some reason. If the dll can not be accesed, then the call to realpath() fails, and you get the "dll path too long" message.

In my case, the path was never too long. Making the change below lets you debug your applications:

--- gdb-7.9.1-1.src/gdb.i686/src/gdb-7.9.1/gdb/windows-nat.c.orig 2015-11-23 11:43:17.834000000 +0000
+++ gdb-7.9.1-1.src/gdb.i686/src/gdb-7.9.1/gdb/windows-nat.c 2015-11-23 14:17:30.302252500 +0000
@@ -623,7 +623,8 @@ windows_make_so (const char *name, LPVOI
free (rname);
}
else
- error (_("dll path too long"));
+ warning (_("dll path too long, or can not be accessed '\"%s\"'"),
+ name);
}
/* Record cygwin1.dll .text start/end. */
p = strchr (so->so_name, '\0') - (sizeof ("/cygwin1.dll") - 1);

Hope this helps!
Tim

Reply | Threaded
Open this post in threaded view
|

Re: gdb 7.8 consistently fails to run executable - error is

Vanda Vodkamilkevich
In reply to this post by Dominik Straßer
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: gdb 7.8 consistently fails to run executable - error is

Corinna Vinschen-2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: gdb 7.8 consistently fails to run executable - error is

Jon TURNEY
In reply to this post by Tim Chick
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: gdb 7.8 consistently fails to run executable - error is

Tim Chick
Jon TURNEY wrote
Can you provide some more information about what path realpath() is
failing for, and do you have any idea why?
The first one which fails for me is "c:\windows\system32\dgapi.dll"

I believe this is some security software installed on my machine by my employer. I guess the software wants to hide itself!

I can't actually try the package, as I'm using 32-bit cygwin, sorry.

Thanks,
Tim
Reply | Threaded
Open this post in threaded view
|

Re: gdb 7.8 consistently fails to run executable - error is

Jon TURNEY
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: gdb 7.8 consistently fails to run executable - error is

Tim Chick
Jon TURNEY wrote
On 14/01/2016 16:02, Tim Chick wrote:
> Jon TURNEY wrote

I built a 32-bit version as well, but there was a slight delay with that
getting moved into the release.  It should be mirroring out now, though.
Hi Jon,

I've just tried the 7.10.1-1 package, and it works fine for me.

Thanks!
Tim
Reply | Threaded
Open this post in threaded view
|

Re: gdb 7.8 consistently fails to run executable - error is

Jon TURNEY
CONTENTS DELETED
The author has deleted this message.