[LLVMdev] Files to lib/System/Win32

Jeff Cohen jeffc at jolt-lang.org
Sun Sep 19 12:35:48 PDT 2004


Completed testing.  Diffs for Path.cpp attached to fix bugs.

Some of them are probably present in the Unix version as well.

There are some uses of ThrowError when there is no error present in
errno to format.  A throw statement should be used.

Path::is_valid uses realpath on Unix.  The problem is that realpath
validates that all the directory components of the path actually exist
and are executable.  There are two problems with this.  First, Path.h
states that is_valid does syntactic validation only.  Second, it is
impossible to create a series of nested directories with
create_directory(true) as such a path would be invalid according to
realpath and hence is_valid.  I changed the Win32 version to only
perform syntactic validation. 

Path::create_directory had other problems.  The use of path::copy to
make a local copy of the path assumed there was a null terminator.
std::string doesn't use null termination.  The parsing code to identify
the intermediate directories wasn't correct either.

My first implementation of create_file was incorrect because it
succeeded even if the file already existed.  I fixed that, but creating
a file to serialize concurrent programs is a Unix paradigm that is not
appropriate for all platforms.  On Windows the preferred way is to use a
mutex, which cleans up after itself if a program dies abnormally.


On Sat, 18 Sep 2004 22:38:25 -0700
Reid Spencer <reid at x10sys.com> wrote:

> Patch committed. Thanks for cleaning up some of the coding standards
> issues.
> 
> Reid.
> 
> On Sat, 2004-09-18 at 22:18, Jeff Cohen wrote:
> > Patch for Signals.cpp attached.
> > 
> > On Sat, 18 Sep 2004 21:30:12 -0700
> > Jeff Cohen <jeffc at jolt-lang.org> wrote:
> > 
> > > On Sat, 18 Sep 2004 12:30:41 -0700
> > > Reid Spencer <reid at x10sys.com> wrote:
> > > 
> > > > Patch looks good so I committed it. I'd be interested in knowing what
> > > > your test results are once you start testing with the Win32 port.
> > > 
> > > I tested Signals.cpp and verified that the CTRL/C handler works, as does
> > > the stack trace.  In fact, here's a sample:
> > > 
> > > 77E73887 (0xE06D7363 0x00000001 0x00000003 0x0012FF28), RaiseException()+0080 bytes(s)
> > > 10226DB9 (0x0012FF44 0x0040DEFC 0x00020024 0x00647373), _CxxThrowException()+0057 bytes(s)
> > > 00401822 (0x0012FFC0 0x00409A2C 0x00000001 0x003250D0), XYZ::func()+0034 bytes(s), c:\projects\llvm\test.cpp, line 12
> > > 004017ED (0x00000001 0x003250D0 0x00322C68 0x00020024), main()+0013 bytes(s), c:\projects\llvm\test.cpp, line 19
> > > 00409A2C (0x00020024 0x7FFDF000 0x7FFDF000 0xF3893CF0), mainCRTStartup()+0300 bytes(s), f:\vs70builds\3077\vc\crtbld\crt\src\crtexe.c, line 398+0017 byte(s)
> > > 77E814C7 (0x00409900 0x00000000 0x78746341 0x00000020), GetCurrentDirectoryW()+0068 bytes(s)
> > > 
> > > However, for some reason I haven't been able to determine, the lovely
> > > trace you see above comes out only on Windows XP.  On Windows 2000, it
> > > can't get the symbol information for EXEs, though it does for DLLs.  I
> > > know this code worked on 2000 in the past, so it must be something that
> > > broke with VC 7.1.  Oh well.
> > > 
> > > (The GetCurrentDirectoryW is bogus, but the top of the stack usually is).
> > > 
> > > I did make some minor changes that I'll submit shortly.
> > > 
> > > _______________________________________________
> > > LLVM Developers mailing list
> > > LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> > > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
> > 
> > ______________________________________________________________________
> > _______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Path.diff
Type: application/octet-stream
Size: 5961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040919/b7814c73/attachment.obj>


More information about the llvm-dev mailing list