This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Seg Fault while using /dev/clipboard


On Fri, 4 Mar 2005, Igor Pechtchanski wrote:

> On Fri, 4 Mar 2005, Pat Kane wrote:
>
> > I am having problems using /dev/clipboard.  When there is a text
> > selection on the Windows clipboard things work as expected, but if
> > there is some other type of selection I get:   "Segmentation fault (core
> > dumped)"
> >
> > To duplicate the problem try:       cat  /dev/clipboard
> > first with a text selection and then after using Windows to copy a program
> > (right click, copy),
> > or after taking a screen  snapshot (cntrl-alt-prntScrn).
> >
> > I am using Cygwin DLL 1.5.13-1  on Win2k V5 SP4,
>
> Ok, I can reproduce this on WinXP Pro SP1.  The last few lines of strace
> before the exception[*] show a read call that executes normally, and then
> a SEGV.  Someone with a debug version of Cygwin should be able to trace
> through this in gdb.

As I hit "Send", I realized that I have a (slightly older) debug version
of the DLL compiled from CVS, that also exhibits this problem.  I don't
have time to delve into this now, but, just in case it helps, here's the
gdb trace:

(gdb) info threads
* 3 thread 9564.0x534  0x77f75a59 in ?? ()
   from /cygdrive/c/WINDOWS/System32/ntdll.dll
  2 thread 9564.0x2488  0x7ffe0304 in ?? ()
  1 thread 9564.0x24fc  0x610b3df1 in strlen ()
    at /usr/src/cygwin-cvs/src/winsup/cygwin/cygserver.h:82
Current language:  auto; currently c++
(gdb) thread 1
[Switching to thread 1 (thread 9564.0x24fc)]#0  0x610b3df1 in strlen ()
    at /usr/src/cygwin-cvs/src/winsup/cygwin/cygserver.h:82
82	  ssize_t error_code () const { return _header.error_code; };
(gdb) where
#0  0x610b3df1 in strlen ()
    at /usr/src/cygwin-cvs/src/winsup/cygwin/cygserver.h:82
#1  0x6101da6f in fhandler_dev_clipboard::read (this=0x61804d50,
    ptr=0x100102d8, len=@0x77e75a90)
    at /usr/src/cygwin-cvs/src/winsup/cygwin/fhandler_clipboard.cc:230
#2  0x0022ed8c in ?? ()
#3  0x77f5abb5 in ?? () from /cygdrive/c/WINDOWS/System32/ntdll.dll
#4  0x77e75a90 in KERNEL32!IsBadWritePtr ()
   from /cygdrive/c/WINDOWS/system32/kernel32.dll
#5  0x00000400 in ?? ()
#6  0x0022ee60 in ?? ()
#7  0x00000001 in ?? ()
#8  0x10010000 in ?? ()
#9  0x00000000 in ?? () from
(gdb) list
77			  size_t bufsiz = 0);
78	  virtual ~client_request ();
79
80	  request_code_t request_code () const { return _header.request_code; }
81
82	  ssize_t error_code () const { return _header.error_code; };
83	  void error_code (ssize_t error_code) { _header.error_code = error_code; };
84
85	  size_t msglen () const { return _header.msglen; };
86	  void msglen (size_t len) { _header.msglen = len; };
(gdb) up
#1  0x6101da6f in fhandler_dev_clipboard::read (this=0x61804d50,
    ptr=0x100102d8, len=@0x77e75a90)
    at /usr/src/cygwin-cvs/src/winsup/cygwin/fhandler_clipboard.cc:230
(gdb) list
230		      ret = ((len > (strlen (lpstr) - pos)) ? (strlen (lpstr) - pos)
225		  else
226		    {
227		      LPSTR lpstr;
228		      lpstr = (LPSTR) GlobalLock (hglb);
229
230		      ret = ((len > (strlen (lpstr) - pos)) ? (strlen (lpstr) - pos)
231			     : len);
232
233		      memcpy (ptr, lpstr + pos, ret);
234		      //ret = snprintf((char *) ptr, len, "%s", lpstr);//+pos);
(gdb) quit

HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]