Ryan Johnson | 27 Jul 05:29 2013
Picon
Picon

64-bit gdb: invalid decimal " 0x22DBF0"

Hi all,

The latest 64-bit gdb/cygwin combo chokes whenever a process it has 
attached to is backgrounded (and also if it blocks on I/O, I think). To 
repro with the attached STC:

1. gcc -g bug.c && ./a
<prints its PID>
2. gdb -p <PID>
3. Continue gdb
4. ^Z the STC
5. STC freezes, gdb gets confused.

An example gdb session is below. Note that, in spite of gdb thinking the 
threads are all running, the victim is actually frozen; once this 
happens, the only option is to detach from the process.
> (gdb) attach 2468
> Attaching to program `/home/Ryan/experiments/a.exe', process 3536
> [New Thread 3536.0x1134]
> [New Thread 3536.0x1284]
> [New Thread 3536.0x13e4]
> Reading symbols from /home/Ryan/experiments/a.exe...done.
> (gdb) c
> Continuing.
> invalid decimal " 0x22DBF0"
> (gdb) c
> Continuing.
> Cannot execute this command without a live selected thread.
> (gdb) i th
>   Id   Target Id         Frame
(Continue reading)

Daniel Brown | 27 Jul 12:30 2013
Picon
Picon

Re: 64-bit gdb: invalid decimal " 0x22DBF0"

I have also ran into this problem, in my case though I have managed to 
reduce the issue down to an fgets call when reading a pipe.
The following code causes the issue for me if I try and debug it:

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv) {
     char out[100] = {0};
     FILE *pipe;

     if ((pipe = popen("uname -r", "rt")) == NULL)
         fprintf(stderr,"Failed to execute popen command");

     if(fgets(out, 100, pipe) == NULL)
         fprintf(stderr,"Failed to read popen buffer");

     printf("%s\n", out);

     pclose(pipe);

     return (EXIT_SUCCESS);
}

I compile with `gcc -g main.c` then `gdb a.exe` and type `run`, the 
error `invalid decimal " 0x23DBF0"` then pops up.
I have tried the latest snapshot cygwin1.dll (1.7.23s(0.268/5/3)) and 
the error is still there.

Thanks,
(Continue reading)

Ryan Johnson | 27 Jul 21:42 2013
Picon
Picon

Re: 64-bit gdb: invalid decimal " 0x22DBF0"

On 27/07/2013 6:30 AM, Daniel Brown wrote:
> I have also ran into this problem, in my case though I have managed to 
> reduce the issue down to an fgets call when reading a pipe.
> The following code causes the issue for me if I try and debug it:
<STC snipped>

That STC let me get a stack trace of gdb:
> #0  write (fd=2, ptr=ptr <at> entry=0x600298c70, len=len <at> entry=27)
>     at /usr/src/debug/cygwin-1.7.22-1/winsup/cygwin/syscalls.cc:1215
> #1  0x00000001801aef93 in _write_r (ptr=ptr <at> entry=0xc2d440,
>     fd=<optimized out>, buf=buf <at> entry=0x600298c70, cnt=cnt <at> entry=27)
>     at /usr/src/debug/cygwin-1.7.22-1/newlib/libc/reent/writer.c:58
> #2  0x000000018019c2bf in __swrite64 (ptr=0xc2d440,
>     cookie=0x1801cb608 <reent_data+1704>,
>     buf=0x600298c70 "invalid decimal \" 0x22DBF0\"", n=27)
>     at /usr/src/debug/cygwin-1.7.22-1/newlib/libc/stdio64/stdio64.c:71
> #3  0x000000018019bc00 in __sfvwrite_r (ptr=ptr <at> entry=0xc2d440,
>     fp=fp <at> entry=0x1801cb608 <reent_data+1704>, uio=uio <at> entry=0xc2a690)
>     at /usr/src/debug/cygwin-1.7.22-1/newlib/libc/stdio/fvwrite.c:97
> #4  0x00000001801752e4 in _fputs_r (ptr=0xc2d440, s=<optimized out>,
>     fp=0x1801cb608 <reent_data+1704>)
>     at /usr/src/debug/cygwin-1.7.22-1/newlib/libc/stdio/fputs.c:94
> #5  0x00000001801130cb in _sigfe () from /usr/bin/cygwin1.dll
... ten frames of garbage...
> #15 0x0000000100513f7a in print_exception (file=0x60017c920, 
> file <at> entry=0x0, e=...)
>     at /usr/src/debug/gdb-7.6-2/gdb/exceptions.c:303
> #16 0x00000001005144e4 in exception_print (file=0x0, e=...)
>     at /usr/src/debug/gdb-7.6-2/gdb/exceptions.c:333
> #17 0x000000010051c8bc in start_event_loop ()
(Continue reading)

Corinna Vinschen | 29 Jul 13:06 2013

Re: 64-bit gdb: invalid decimal " 0x22DBF0"

On Jul 27 11:30, Daniel Brown wrote:
> I have also ran into this problem, in my case though I have managed
> to reduce the issue down to an fgets call when reading a pipe.
> The following code causes the issue for me if I try and debug it:
> 
> #include <stdio.h>
> #include <stdlib.h>
> 
> int main(int argc, char** argv) {
>     char out[100] = {0};
>     FILE *pipe;
> 
>     if ((pipe = popen("uname -r", "rt")) == NULL)
>         fprintf(stderr,"Failed to execute popen command");
> 
>     if(fgets(out, 100, pipe) == NULL)
>         fprintf(stderr,"Failed to read popen buffer");
> 
>     printf("%s\n", out);
> 
>     pclose(pipe);
> 
>     return (EXIT_SUCCESS);
> }
> 
> I compile with `gcc -g main.c` then `gdb a.exe` and type `run`, the
> error `invalid decimal " 0x23DBF0"` then pops up.
> I have tried the latest snapshot cygwin1.dll (1.7.23s(0.268/5/3))
> and the error is still there.

(Continue reading)

Ryan Johnson | 29 Jul 18:01 2013
Picon
Picon

gdb hangs on ^Z [was: Re: 64-bit gdb: invalid decimal " 0x22DBF0"]

On 29/07/2013 7:06 AM, Corinna Vinschen wrote:
> On Jul 27 11:30, Daniel Brown wrote:
>> I have also ran into this problem, in my case though I have managed
>> to reduce the issue down to an fgets call when reading a pipe.
>> The following code causes the issue for me if I try and debug it:
>>
>> #include <stdio.h>
>> #include <stdlib.h>
>>
>> int main(int argc, char** argv) {
>>      char out[100] = {0};
>>      FILE *pipe;
>>
>>      if ((pipe = popen("uname -r", "rt")) == NULL)
>>          fprintf(stderr,"Failed to execute popen command");
>>
>>      if(fgets(out, 100, pipe) == NULL)
>>          fprintf(stderr,"Failed to read popen buffer");
>>
>>      printf("%s\n", out);
>>
>>      pclose(pipe);
>>
>>      return (EXIT_SUCCESS);
>> }
>>
>> I compile with `gcc -g main.c` then `gdb a.exe` and type `run`, the
>> error `invalid decimal " 0x23DBF0"` then pops up.
>> I have tried the latest snapshot cygwin1.dll (1.7.23s(0.268/5/3))
>> and the error is still there.
(Continue reading)

Corinna Vinschen | 29 Jul 21:11 2013

Re: gdb hangs on ^Z [was: Re: 64-bit gdb: invalid decimal " 0x22DBF0"]

On Jul 29 12:01, Ryan Johnson wrote:
> On 29/07/2013 7:06 AM, Corinna Vinschen wrote:
> >On Jul 27 11:30, Daniel Brown wrote:
> >>I have also ran into this problem, in my case though I have managed
> >>to reduce the issue down to an fgets call when reading a pipe.
> >>The following code causes the issue for me if I try and debug it:
> >>
> >>#include <stdio.h>
> >>#include <stdlib.h>
> >>
> >>int main(int argc, char** argv) {
> >>     char out[100] = {0};
> >>     FILE *pipe;
> >>
> >>     if ((pipe = popen("uname -r", "rt")) == NULL)
> >>         fprintf(stderr,"Failed to execute popen command");
> >>
> >>     if(fgets(out, 100, pipe) == NULL)
> >>         fprintf(stderr,"Failed to read popen buffer");
> >>
> >>     printf("%s\n", out);
> >>
> >>     pclose(pipe);
> >>
> >>     return (EXIT_SUCCESS);
> >>}
> >>
> >>I compile with `gcc -g main.c` then `gdb a.exe` and type `run`, the
> >>error `invalid decimal " 0x23DBF0"` then pops up.
> >>I have tried the latest snapshot cygwin1.dll (1.7.23s(0.268/5/3))
(Continue reading)

Ryan Johnson | 29 Jul 21:13 2013
Picon
Picon

Re: gdb hangs on ^Z [was: Re: 64-bit gdb: invalid decimal " 0x22DBF0"]

On 29/07/2013 3:11 PM, Corinna Vinschen wrote:
> On Jul 29 12:01, Ryan Johnson wrote:
>> On 29/07/2013 7:06 AM, Corinna Vinschen wrote:
>>> On Jul 27 11:30, Daniel Brown wrote:
>>>> I have also ran into this problem, in my case though I have managed
>>>> to reduce the issue down to an fgets call when reading a pipe.
>>>> The following code causes the issue for me if I try and debug it:
>>>>
>>>> #include <stdio.h>
>>>> #include <stdlib.h>
>>>>
>>>> int main(int argc, char** argv) {
>>>>      char out[100] = {0};
>>>>      FILE *pipe;
>>>>
>>>>      if ((pipe = popen("uname -r", "rt")) == NULL)
>>>>          fprintf(stderr,"Failed to execute popen command");
>>>>
>>>>      if(fgets(out, 100, pipe) == NULL)
>>>>          fprintf(stderr,"Failed to read popen buffer");
>>>>
>>>>      printf("%s\n", out);
>>>>
>>>>      pclose(pipe);
>>>>
>>>>      return (EXIT_SUCCESS);
>>>> }
>>>>
>>>> I compile with `gcc -g main.c` then `gdb a.exe` and type `run`, the
>>>> error `invalid decimal " 0x23DBF0"` then pops up.
(Continue reading)

Ryan Johnson | 29 Jul 21:27 2013
Picon
Picon

Re: gdb hangs on ^Z [was: Re: 64-bit gdb: invalid decimal " 0x22DBF0"]

On 29/07/2013 3:13 PM, Ryan Johnson wrote:
> On 29/07/2013 3:11 PM, Corinna Vinschen wrote:
>> On Jul 29 12:01, Ryan Johnson wrote:
>>> On 29/07/2013 7:06 AM, Corinna Vinschen wrote:
>>>> On Jul 27 11:30, Daniel Brown wrote:
>>>>> I have also ran into this problem, in my case though I have managed
>>>>> to reduce the issue down to an fgets call when reading a pipe.
>>>>> The following code causes the issue for me if I try and debug it:
>>>>>
>>>>> #include <stdio.h>
>>>>> #include <stdlib.h>
>>>>>
>>>>> int main(int argc, char** argv) {
>>>>>      char out[100] = {0};
>>>>>      FILE *pipe;
>>>>>
>>>>>      if ((pipe = popen("uname -r", "rt")) == NULL)
>>>>>          fprintf(stderr,"Failed to execute popen command");
>>>>>
>>>>>      if(fgets(out, 100, pipe) == NULL)
>>>>>          fprintf(stderr,"Failed to read popen buffer");
>>>>>
>>>>>      printf("%s\n", out);
>>>>>
>>>>>      pclose(pipe);
>>>>>
>>>>>      return (EXIT_SUCCESS);
>>>>> }
>>>>>
>>>>> I compile with `gcc -g main.c` then `gdb a.exe` and type `run`, the
(Continue reading)

Ryan Johnson | 31 Jul 16:17 2013
Picon
Picon

Re: gdb hangs on ^Z [was: Re: 64-bit gdb: invalid decimal " 0x22DBF0"]

On 29/07/2013 3:27 PM, Ryan Johnson wrote:
> On 29/07/2013 3:13 PM, Ryan Johnson wrote:
>> On 29/07/2013 3:11 PM, Corinna Vinschen wrote:
>>> On Jul 29 12:01, Ryan Johnson wrote:
>>>> On 29/07/2013 7:06 AM, Corinna Vinschen wrote:
>>>>> On Jul 27 11:30, Daniel Brown wrote:
>>>>>> I have also ran into this problem, in my case though I have managed
>>>>>> to reduce the issue down to an fgets call when reading a pipe.
>>>>>> The following code causes the issue for me if I try and debug it:
>>>>>>
>>>>>> #include <stdio.h>
>>>>>> #include <stdlib.h>
>>>>>>
>>>>>> int main(int argc, char** argv) {
>>>>>>      char out[100] = {0};
>>>>>>      FILE *pipe;
>>>>>>
>>>>>>      if ((pipe = popen("uname -r", "rt")) == NULL)
>>>>>>          fprintf(stderr,"Failed to execute popen command");
>>>>>>
>>>>>>      if(fgets(out, 100, pipe) == NULL)
>>>>>>          fprintf(stderr,"Failed to read popen buffer");
>>>>>>
>>>>>>      printf("%s\n", out);
>>>>>>
>>>>>>      pclose(pipe);
>>>>>>
>>>>>>      return (EXIT_SUCCESS);
>>>>>> }
>>>>>>
(Continue reading)


Gmane