public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30017] New: Cygwin gdb fails when given a windows absolute path
@ 2023-01-17 19:25 chgenly at gmail dot com
  2023-01-17 19:33 ` [Bug gdb/30017] " jonah at kichwacoders dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: chgenly at gmail dot com @ 2023-01-17 19:25 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30017

            Bug ID: 30017
           Summary: Cygwin gdb fails when given a windows absolute path
           Product: gdb
           Version: 11.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: chgenly at gmail dot com
  Target Milestone: ---

This is a problem on cygwin.  Launch the cygwin gdb, give it an windows
absolute path to an executable.  From the output you'll see the symbol table is
loaded, so gdb understands the path.  Yet, when attempting to run the program,
it fails to create the process.

A previous version, 9.2-1, works.

To reproduce the problem, run the following shell script from a cygwin
terminal.

echo Create main.c
cat >main.c <<END
#include <stdio.h>
int main(int argc, char**argv) {
   printf("Hello world!");
}
END
echo Compile main.c to main.exe
gcc main.c -o main
cmd="gdb $(cygpath -wa main.exe)"
echo $cmd
$cmd <<END
run
q
END

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30017] Cygwin gdb fails when given a windows absolute path
  2023-01-17 19:25 [Bug gdb/30017] New: Cygwin gdb fails when given a windows absolute path chgenly at gmail dot com
@ 2023-01-17 19:33 ` jonah at kichwacoders dot com
  2023-01-19 19:49 ` chgenly at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jonah at kichwacoders dot com @ 2023-01-17 19:33 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30017

Jonah Graham <jonah at kichwacoders dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jonah at kichwacoders dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30017] Cygwin gdb fails when given a windows absolute path
  2023-01-17 19:25 [Bug gdb/30017] New: Cygwin gdb fails when given a windows absolute path chgenly at gmail dot com
  2023-01-17 19:33 ` [Bug gdb/30017] " jonah at kichwacoders dot com
@ 2023-01-19 19:49 ` chgenly at gmail dot com
  2023-03-05 12:45 ` jon.turney at dronecode dot org.uk
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: chgenly at gmail dot com @ 2023-01-19 19:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30017

--- Comment #1 from Chris Genly <chgenly at gmail dot com> <chgenly at gmail dot com> ---
I forgot to mention that this bug is fairly important because it prevents
eclipse from debugging cygwin applications.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30017] Cygwin gdb fails when given a windows absolute path
  2023-01-17 19:25 [Bug gdb/30017] New: Cygwin gdb fails when given a windows absolute path chgenly at gmail dot com
  2023-01-17 19:33 ` [Bug gdb/30017] " jonah at kichwacoders dot com
  2023-01-19 19:49 ` chgenly at gmail dot com
@ 2023-03-05 12:45 ` jon.turney at dronecode dot org.uk
  2023-03-07  0:54 ` jonah at kichwacoders dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jon.turney at dronecode dot org.uk @ 2023-03-05 12:45 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30017

Jon Turney <jon.turney at dronecode dot org.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jon.turney at dronecode dot org.uk

--- Comment #2 from Jon Turney <jon.turney at dronecode dot org.uk> ---
Using a Windows Eclipse and Winows Java with Cygwin executables is bound to
encounter problems like this, which cannot be generically solved in Cygwin.

Passing Windows-style paths to POSIX API functions which take a pathname
generally works.

But if an executable (in this case, gdb) does some internal manipulation on the
pathname, assuming it's in POSIX-style, you get problems.

The simple solution is to write a wrapper around gdb, which takes a
Windows-style path, and converts it using cygpath to POSIX-style before passing
it to gdb.

The complex solution is to modfiy gdb so it identifies the style of path before
manipulating it appropriately, but some one who cares about this edge-case will
have to write it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30017] Cygwin gdb fails when given a windows absolute path
  2023-01-17 19:25 [Bug gdb/30017] New: Cygwin gdb fails when given a windows absolute path chgenly at gmail dot com
                   ` (2 preceding siblings ...)
  2023-03-05 12:45 ` jon.turney at dronecode dot org.uk
@ 2023-03-07  0:54 ` jonah at kichwacoders dot com
  2023-03-07 21:53 ` jon.turney at dronecode dot org.uk
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jonah at kichwacoders dot com @ 2023-03-07  0:54 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30017

--- Comment #3 from Jonah Graham <jonah at kichwacoders dot com> ---
Thanks Jon for the analysis.

> but some one who cares about this edge-case will have to write it.

I think that is the problem we are facing now as to who will solve this
problem. For the last ~20 years it turns out that CDT was relying on undefined
behaviour in Cygwin/GDB that changed in GDB 10.

We are going to track that work in CDT here
https://github.com/eclipse-cdt/cdt/issues/228 but at the moment no one is
allocated to it, but here is hoping that someone steps forward. I have given
guidance of where someone could start in CDT.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30017] Cygwin gdb fails when given a windows absolute path
  2023-01-17 19:25 [Bug gdb/30017] New: Cygwin gdb fails when given a windows absolute path chgenly at gmail dot com
                   ` (3 preceding siblings ...)
  2023-03-07  0:54 ` jonah at kichwacoders dot com
@ 2023-03-07 21:53 ` jon.turney at dronecode dot org.uk
  2023-03-19 16:46 ` jon.turney at dronecode dot org.uk
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jon.turney at dronecode dot org.uk @ 2023-03-07 21:53 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30017

--- Comment #4 from Jon Turney <jon.turney at dronecode dot org.uk> ---
Note: This is a regression in gdb 10 and later.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30017] Cygwin gdb fails when given a windows absolute path
  2023-01-17 19:25 [Bug gdb/30017] New: Cygwin gdb fails when given a windows absolute path chgenly at gmail dot com
                   ` (4 preceding siblings ...)
  2023-03-07 21:53 ` jon.turney at dronecode dot org.uk
@ 2023-03-19 16:46 ` jon.turney at dronecode dot org.uk
  2023-03-22 18:13 ` jonah at kichwacoders dot com
  2023-03-22 20:43 ` jon.turney at dronecode dot org.uk
  7 siblings, 0 replies; 9+ messages in thread
From: jon.turney at dronecode dot org.uk @ 2023-03-19 16:46 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30017

--- Comment #5 from Jon Turney <jon.turney at dronecode dot org.uk> ---
I bisected this, which lands on :

# first bad commit: [727b7b1864973c2645a554727afd0eaf1303673a] Sync config,
include and libiberty with GCC

Looking at:

https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=727b7b1864973c2645a554727afd0eaf1303673a#patch4

This makes perfect sense, but doesn't really offer a lot of immediate clues how
to fix it.

There's presumably some logic in gdb/windows-nat which uses those macros
(probably IS_ABSOLUTE_PATH given the reported problem), who's behaviour is
changed by this commit.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30017] Cygwin gdb fails when given a windows absolute path
  2023-01-17 19:25 [Bug gdb/30017] New: Cygwin gdb fails when given a windows absolute path chgenly at gmail dot com
                   ` (5 preceding siblings ...)
  2023-03-19 16:46 ` jon.turney at dronecode dot org.uk
@ 2023-03-22 18:13 ` jonah at kichwacoders dot com
  2023-03-22 20:43 ` jon.turney at dronecode dot org.uk
  7 siblings, 0 replies; 9+ messages in thread
From: jonah at kichwacoders dot com @ 2023-03-22 18:13 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30017

--- Comment #6 from Jonah Graham <jonah at kichwacoders dot com> ---
Thanks Jon for the bisect - that points back at GCC bug
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94570 which implies that it was a
deliberate change to fix that use case by stopping having support for Windows
separators and now that GDB has sync'ed to GCC's version we see the effect on
GDB on Cygwin.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30017] Cygwin gdb fails when given a windows absolute path
  2023-01-17 19:25 [Bug gdb/30017] New: Cygwin gdb fails when given a windows absolute path chgenly at gmail dot com
                   ` (6 preceding siblings ...)
  2023-03-22 18:13 ` jonah at kichwacoders dot com
@ 2023-03-22 20:43 ` jon.turney at dronecode dot org.uk
  7 siblings, 0 replies; 9+ messages in thread
From: jon.turney at dronecode dot org.uk @ 2023-03-22 20:43 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30017

--- Comment #7 from Jon Turney <jon.turney at dronecode dot org.uk> ---
Yes, the way to fix this is not to try to revert that commit, but, as I
mentioned previously, to add explicit handling for Windows-style paths on
Cygwin in the place where this change makes it go wrong.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-03-22 20:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 19:25 [Bug gdb/30017] New: Cygwin gdb fails when given a windows absolute path chgenly at gmail dot com
2023-01-17 19:33 ` [Bug gdb/30017] " jonah at kichwacoders dot com
2023-01-19 19:49 ` chgenly at gmail dot com
2023-03-05 12:45 ` jon.turney at dronecode dot org.uk
2023-03-07  0:54 ` jonah at kichwacoders dot com
2023-03-07 21:53 ` jon.turney at dronecode dot org.uk
2023-03-19 16:46 ` jon.turney at dronecode dot org.uk
2023-03-22 18:13 ` jonah at kichwacoders dot com
2023-03-22 20:43 ` jon.turney at dronecode dot org.uk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).