> I read some docs about COFF and CodeView formats, both supported by
> Visual Studio. However, it seems the COFF format does not contain line
> numbers [1]. Or maybe this reads as "Visual Studio does not put line
> numbers in COFF format". I did not read the specification for COFF
> yet.
For the record, COFF does support line numbers natively. For many
targets it uses a 16-bit field for the line number, which can be
limiting. More seriously, COFF only stores a line number; it has no way
of associating the line number with a specific file. This makes it
nearly useless for C++, or for Go. I don't know what Visual Studio
does.
Ian
PDB certainly handles C,C++ and .NET (C#). It probably can represent more.
Basic, read-only support is baked directly into windows in the form of
DbgHelp.dll (http://msdn.microsoft.com/en-us/library/windows/desktop/ms679294(v=vs.85).aspx)
and a richer interface via DIA SDK
(http://msdn.microsoft.com/en-us/library/t6tay6cz(v=VS.100).aspx)
The format is not officially documented. However, Microsoft released
an open-source, C# library for PDB format. Mono folks use it e.g. to
convert pdb files to mono's native mdb format:
https://github.com/mono/mono/tree/master/mcs/tools/pdb2mdb
https://github.com/mono/mono/blob/master/mcs/tools/pdb2mdb/CvInfo.cs
is a pretty good description of the format.
-- kjk
2011/10/5 Remi Gillig <remig...@gmail.com>:
... Does that mean you can use gdb in Windows to
debug the binaries then?
... I don't know if it would
even be possible to output DWARF even for Windows binaries.
So as of today, you can have the symbols from a Windows executable
with the nm command?
I don't see which part of that page implies PDBs don't support C#.
From http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/05/11/pdb-files-what-every-developer-must-know.aspx:
"A .NET PDB only contains two pieces of information, the source file
names and their lines and the local variable names. All the other
information is already in the .NET metadata so there is no need to
duplicate the same information in a PDB file."
Or: compile a C# program with Microsoft tools and check that a PDB
files is generated (if the right flags are used).
That page isn't really talking about PDBs but about extending Visual
Studio IDE with a custom debugging engine. They explicitly say that if
a tool generates PDB files, this is not necessary. It's only needed if
you want to implement a more esoteric scenario like e.g. remotely
debugging Linux executables running on Linux hosts from within Visual
Studio IDE (see e.g. how Mono folks have Visual Studio plugin that
allows debugging Mono with Visual Studio IDE
http://mono-tools.com/Debug.aspx).
You could use that Visual Studio extensibility to implement a Go
debugger hosted inside Visual Studio but it would be much simpler to
generate PDB files and it would work with any Windows tool, not just
Visual Studio.
-- kjk
2011/10/5 Remi Gillig <remig...@gmail.com>:
I'd be interested in links to said compilers.
-joe
Possibly some useful/helpful information here:
http://dsource.org/projects/cv2pdb
http://tinyurl.com/ycu2gkc
-joe
The Intel compiler is a front-end that needs to hook into a back-end,
e.g. into MS VC++ or GCC. Last I knew (version 11.0) the Intel
compiler (front-end) only generated DWARF2 and coff, but when it's
hooked into MS VC++ it can have VC++'s back-end linker generate a pdb
file. I could be wrong about VC++'s linker generating the pdb file
though.
There aren't that many C/C++ compilers for Windows (8 or so) and pdg
is exclusive to Microsoft, as far as I know.
Full Compilers:
TCC
Pelles C
Watcom C/C++
DIgital Mars C/C++
DeSmet C
LCC
Portland Group C/C++
... not many more
Compiler front-ends:
Intel C++
Comeau C/C++
Edison Design Group (they make C/C++ front-ends, think Intel, TI, MS)
-joe
For me this brings up a really interesting question that (I admit) is
quite irrelevant to the go nuts. I'll make it quick: Microsoft
doesn't support much of C99. Do you know if I can use the Intel front
end plus the Microsoft backend to compile C99 code on Windows?
Thanks,
JD
I don't think Intel's front-end is fully C99 compliant. I heard a
rumor that the current version of Visual Studio had somewhere around
98% C99 compliance?
IMHO, one of the best C/C++ compliers for windows is from The Portland
Group. The C/C++ compiler generates some of the fastest code you'll
find, it comes with a nice Graphical debugger and a profiler (both
will do local MPI), and is C99 compliant. Also, the Comeau Computing
front-end for VC++ works nice and is 100% C99 compliant, although I
haven't used it for 4 or 5 years.
-joe
I guess it makes sense to focus on C++ because most of the Windows
specific things like COM are in C++.
-joe
Isn't C++ builder just an IDE? Notable omissions from the list,
clang\LLVM and GCC
>
> Intel C++ is a full compiler with its own set of compiler backend
> optimizations.
>
You're right that it does do backend optimizations, but I wouldn't say
it's a full compiler because it requires parts of either GCC's or
Visual Studio's back-end. But it's definitely not just a front-end
either as I had _incorrectly_ stated.
-joe
I doesn't require any back-end. It's a full compiler that you can run
from the command line if you don't have Visual Studio. It works. I
don't have Visual Studio.
--
Aram Hăvărneanu
Actually it doesn't. You can run it without Visual Studio (and you
can run Microsoft compiler without Visual Studio as well, just install
WDK, the Windows Driver Kit, it's a tarball of the build tools that
use to build Windows with).
--
Aram Hăvărneanu
To get the Visual Studio command line driven compiler tools you need
to install Visual Studio. Not talking about the IDE. The last version
of the Intel compiler I used was for 32-bit platforms and it required
GCC when installed on OSX or Linux and Visual Studio's command line
compiler tools on Windows.
-joe
No, you don't. Just get the WDK:
http://msdn.microsoft.com/en-us/windows/hardware/gg487463
It's a tarball of the build infrastructure used to build Windows. It
contains compilers and build tools. Although it comes with an
installer it's really just a tarball, you cam move it around. Many
shops keep it on a network share and many shops (Microsoft included)
keep it in they version control along with sources. Theoretically
it's offered to be used for writing drivers but it can build user mode
applications too (as I said, Windows itself is built with it). It has
the nice bonus of not coming with gigabytes of useless GUIs and also
the nice bonus of creating binaries that don't depend on Visual Studio
shared libraries.
> Not talking about the IDE. The last version
> of the Intel compiler I used was for 32-bit platforms and it required
> GCC when installed on OSX or Linux and Visual Studio's command line
> compiler tools on Windows.
No idea about OS X or Linux, on Windows it install a Visual Studio
plugin, hence the dependency, but it runs just fine without. In fact
Intel compiler's front-end come from EDG ( http://www.edg.com/ ), only
the back end is implemented in house.
--
Aram Hăvărneanu
I agree. WDK and WinDBG were/are a great combination. At some point I
think WinDBG got packaged with the WDK.
Unfortunately, older versions of the Intel compiler (for 32-bit
platforms) wouldn't work properly unless it found Microsoft's command
line compiler tools via Visual Studio's installation directory
structure.
>
>> Not talking about the IDE. The last version
>> of the Intel compiler I used was for 32-bit platforms and it required
>> GCC when installed on OSX or Linux and Visual Studio's command line
>> compiler tools on Windows.
>
> No idea about OS X or Linux, on Windows it install a Visual Studio
> plugin, hence the dependency, but it runs just fine without. In fact
> Intel compiler's front-end come from EDG ( http://www.edg.com/ ), only
> the back end is implemented in house.
>
> --
> Aram Hăvărneanu
>
The Intel compiler has evolved a lot over the years, to include
removal of dependencies, and I'm not sure how it works these days.
Unfortunately it's C front-end still isn't fully C99 compliant.
-joe
Yes. It's good that's in the WDK, but it isn't so good that it's
*only* in the WDK and not available standalone. I used to install it
on all my computers. Good news is that it's still relocatable and if
you have a WDK installed somewhere you can steal WinDBG from there.
> Unfortunately it's C front-end still isn't fully C99 compliant.
On the other hand it's much more compliant than Visual Studio's
compiler. Microsoft was pretty clear that they won't do C99 and that
they expect people to write C++. Intel is at least trying to do C99.
--
Aram Hăvărneanu
And depending on the project it might work better or worse than the
WDK. It might work better because it comes with msbuild and all the
Visual Studio specific build tools so you might build Visual Studio
projects/solutions.
On the other hand you cannot maintain those solutions by hand because
they are a cluster of machine generated XML and the binaries depend on
Visual Studio shared libraries that have to be *installed* (by a .msi,
not copied along with the executable) on target computers.
WDK doesn't have msbuild, but it has build.exe (tool used to build
Windows). It's not a bad tool, you only need to create a makefile
that specifies the files and the target type. Sort of how Go
makefiles work. And binaries generated depend only on libraries that
are part of the operating system (you can target a wide variety of
older operating systems).
If someone would want to port some Unix software to Windows I'd
recommend the WDK, not Windows SDK or Visual Studio.
--
Aram Hăvărneanu