Ethereal-dev: [Ethereal-dev] Re: How do I get .pdb file under Win32

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Motonori Shindo <mshindo@xxxxxxxxxxx>
Date: Tue, 11 Dec 2001 23:06:06 +0900 (JST)
Hi,

From: Motonori Shindo <mshindo@xxxxxxxxxxx>
Subject: How do I get .pdb file under Win32
Date: Sun, 09 Dec 2001 20:05:04 +0900 (JST)

> How can I make ethereal.pdb, tethereal.pdb, and editcap.pdb get
> created? In my Win32 environment, those files are not created after
> nmake while following files are created:
> 
>   ./plugins/vc60.pdb
>   ./plugins/giop/vc60.pdb
>   ./plugins/gryphon/vc60.pdb
>   ./plugins/mgcp/vc60.pdb
>   ./tools/lemon/vc60.pdb
>   ./tools/lemon/lemon.pdb

I finally figured it out why ethereal.pdb, tethereal.pdb, and
editcap.pdb are not created. There are in fact two issues involved.

The first one is that vc60.pdb is not created for some
targets. vc60.pdb is created for the target listed above, but not
created for other targets like epan/dfilter/vc60.pdb. This is caused
by a bogus batch mode inference rule of nmake. All targets for which
vc60.pdb is not created have the following inference rule:

{$S}.c{$O}.obj::
   $(CC) $(CVARSDLL) $(CFLAGS) -Fd$O\ -c $<

where neighter S nor O is defined. This rule is obviously bogus but
fortunately it does work OK because $S and $O is NULL which happens to
represent a current directory. The real problem is -Fd$O\ part. Since
$O is NULL, it is expanded as -Fd\ and vc60.pdb ends up with being
created as C:\vc60.pdb for all targets which have this inference
rule. While it often works, it is not what this Makfile.nmake intends
to do. There are several ways to fix this problem. One is to define S
and O as '.' (current directory). However, in this case, the object
file has to look like './bar.obj' to match with this inference
rule. So we'd have to change Makefile.nmake like,

S = .
O = .

{$S}.c{$O}.obj::
   $(CC) $(CVARSDLL) $(CFLAGS) -Fd$O\ -c $<

OBJECTS = \
        $O/dfilter.obj             \
        $O/dfvm.obj                \
        $O/drange.obj              \
        $O/gencode.obj             \

...

Well, this is a bit of work.

Another possible way is to change it as follows, considering that, for
the time being, we only care about the current directory for a given
target:

.c.obj::
   $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<

In this case, we now completely get rid of S and O macro, assuming *.c
and *.o reside on the same (current) directory and having *.pdb file
also get created on the current directory. I took the latter way in my
patch enclosed.

The second issue is that ethereal.pdb, tethereal.pdb, etc. are not
created. This problem was introduced when $(guiflags) and $(conflags)
were added to a rule for LINK back in March 23, 2001. guiflags and
conflags are defined in win32.mak and they both include "PDB:NONE"
definition. Due to this definition, .pdb file that is supposed to be
created by LINK is not created at all. This bug has been around more
than 8 months but no one has noticed it. Even worse,
{ethereal,tethereal,editcap}.pdb that are packaged in the official
distribution (even in the latest 0.8.20) appear to be stale (see the
time stamp of these files, which is dated as March 2001:-)). Part of
this reason that we didn't notice this bug for such a long time is
that *.pdb file is not deleted even if we do 'nmake -f Makefile.nmake
clean'. I have added these files to be deleted in Makefile.nmake (pls
see a patch enclosed).

For guiflags/confilags problem, I don't have a good answer. One way is
to modify win32.mak directly and get rid of PDB:NONE part from
guiflags/conflags definition, which is ugly. Another way (which might
be better than the first one, but still not ellegant) is to get rid of
guiflags/conflags from Makefile.nmake and then add what
guiflags/conflags used to define excluding PDB:NONE part. I haven't
addressed this problem in my enclosed patch so I'd love to hear any
good idea or suggestion.

I also added mergecap.pdb and text2pcap in ethereal.nsi.in.

Regards,

=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
 +----+----+     
 |.. .|    |     Motonori Shindo
 |_~__|    |     
 | .. |~~_~|     Sr. Systems Engineer
 | .  |    |     CoSine Communications Inc.
 +----+----+     
 C o S i n e     e-mail:  mshindo@xxxxxxxxxxxxx 
Communications
=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=

Index: Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/Makefile.nmake,v
retrieving revision 1.152
diff -u -r1.152 Makefile.nmake
--- Makefile.nmake	2001/12/11 03:04:26	1.152
+++ Makefile.nmake	2001/12/11 14:16:00
@@ -19,8 +19,8 @@
 
 CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
 
-{$S}.c{$O}.obj::
-   $(CC) $(CVARSDLL) $(CFLAGS) -Fd$O\ -c $<
+.c.obj::
+   $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
 
 DISSECTOR_SRC = \
 	packet-aarp.c  \
@@ -328,6 +328,10 @@
 
 EXECUTABLES=ethereal.exe tethereal.exe editcap.exe mergecap.exe text2pcap.exe
 
+EXECUTABLES_PDBS = $(EXECUTABLES:.exe=.pdb)
+
+PDBS = $(EXECUTABLES_PDBS) $(PDB_FILE) 
+
 RESOURCES=image\ethereal.res image\tethereal.res image\editcap.res image\mergecap.res image\text2pcap.res
 
 all: tools wiretap gtk epan image $(EXECUTABLES) $(RESOURCES)
@@ -400,10 +404,10 @@
 	$(LEX) -otext2pcap-scanner.c text2pcap-scanner.l
 
 clean:
-	rm -f $(ethereal_OBJECTS) $(EXTRA_OBJECTS) $(EXECUTABLES) \
+	rm -f $(ethereal_OBJECTS) $(EXTRA_OBJECTS) $(EXECUTABLES) $(PDBS) \
 		tethereal.obj editcap.obj mergecap.obj text2pcap.obj \
 		text2pcap-scanner.obj text2pcap-scanner.c register.c \
-		rdps.obj config.h ps.c packet-ncp2222.c register.c
+		rdps.obj rdps.pdb config.h ps.c packet-ncp2222.c register.c
 	cd wiretap
 	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
 	cd ../gtk
Index: config.nmake
===================================================================
RCS file: /cvsroot/ethereal/config.nmake,v
retrieving revision 1.17
diff -u -r1.17 config.nmake
--- config.nmake	2001/10/12 17:17:04	1.17
+++ config.nmake	2001/12/11 14:16:01
@@ -14,6 +14,7 @@
 
 LOCAL_CFLAGS=-Zi
 LOCAL_LDFLAGS=/DEBUG
+PDB_FILE=vc60.pdb
 
 # Set path if you need to find some binary
 #PATH=t:\w32-ix86\cygnus\cygwin-b20\H-i586-cygwin32\bin;$(PATH)
Index: epan/Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/epan/Makefile.nmake,v
retrieving revision 1.20
diff -u -r1.20 Makefile.nmake
--- Makefile.nmake	2001/11/24 21:51:40	1.20
+++ Makefile.nmake	2001/12/11 14:16:16
@@ -15,8 +15,8 @@
 	$(GLIB_DIR)\glib-$(GLIB_VERSION).lib \
 	$(GLIB_DIR)\gmodule\gmodule-$(GLIB_VERSION).lib
 
-{$S}.c{$O}.obj::
-   $(CC) $(CVARSDLL) $(CFLAGS) -Fd$O\ -c $<
+.c.obj::
+   $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
 
 OBJECTS=atalk-utils.obj	\
 	bitswap.obj	\
@@ -56,7 +56,7 @@
 	sed -e s/@VERSION@/$(VERSION)/ < config.h.win32 > $@
 
 clean:
-	rm -f $(OBJECTS) ethereal.lib config.h
+	rm -f $(OBJECTS) ethereal.lib config.h $(PDB_FILE)
 	cd ftypes
 	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
 	cd ../dfilter
Index: epan/dfilter/Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/epan/dfilter/Makefile.nmake,v
retrieving revision 1.5
diff -u -r1.5 Makefile.nmake
--- Makefile.nmake	2001/03/23 02:05:24	1.5
+++ Makefile.nmake	2001/12/11 14:16:16
@@ -11,8 +11,8 @@
 
 CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
 
-{$S}.c{$O}.obj::
-   $(CC) $(CVARSDLL) $(CFLAGS) -Fd$O\ -c $<
+.c.obj::
+   $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
 
 
 OBJECTS = \
@@ -37,7 +37,8 @@
 
 
 clean:
-	rm -f $(OBJECTS) scanner.c grammar.c grammar.h grammar.out dfilter.lib
+	rm -f $(OBJECTS) scanner.c grammar.c grammar.h grammar.out \
+	dfilter.lib $(PDB_FILE)
 
 scanner.c : scanner.l
 	$(LEX) -Pdf_ -oscanner.c scanner.l
Index: epan/ftypes/Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/epan/ftypes/Makefile.nmake,v
retrieving revision 1.2
diff -u -r1.2 Makefile.nmake
--- Makefile.nmake	2001/03/23 02:05:26	1.2
+++ Makefile.nmake	2001/12/11 14:16:17
@@ -9,8 +9,8 @@
 
 CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL 
 
-{$S}.c{$O}.obj::
-   $(CC) $(CVARSDLL) $(CFLAGS) -Fd$O\ -c $<
+.c.obj::
+   $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
 
 
 OBJECTS = \
@@ -30,5 +30,5 @@
 
 
 clean:
-	rm -f $(OBJECTS) ftypes.lib
+	rm -f $(OBJECTS) ftypes.lib $(PDB_FILE)
 
Index: gtk/Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/gtk/Makefile.nmake,v
retrieving revision 1.21
diff -u -r1.21 Makefile.nmake
--- Makefile.nmake	2001/12/08 09:27:50	1.21
+++ Makefile.nmake	2001/12/11 14:16:17
@@ -11,8 +11,8 @@
 
 CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
 
-{$S}.c{$O}.obj::
-   $(CC) $(CVARSDLL) $(CFLAGS) -Fd$O\ -c $<
+.c.obj::
+   $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
 
 # gtkclist.obj is not in here because it is gtk+-1.2 code,
 # while the DLL for GTK+ on windows is gtk+-1.3, and there's
@@ -57,4 +57,4 @@
 
 
 clean:
-	rm -f $(OBJECTS) libui.lib
+	rm -f $(OBJECTS) libui.lib $(PDB_FILE)
Index: packaging/nsis/Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/packaging/nsis/Makefile.nmake,v
retrieving revision 1.7
diff -u -r1.7 Makefile.nmake
--- Makefile.nmake	2001/07/12 22:45:23	1.7
+++ Makefile.nmake	2001/12/11 14:16:33
@@ -12,7 +12,8 @@
 
 EXE=../../ethereal.exe ../../tethereal.exe ../../editcap.exe \
 	../../text2pcap.exe ../../mergecap.exe
-PDB=../../ethereal.pdb ../../tethereal.pdb ../../editcap.pdb
+PDB=../../ethereal.pdb ../../tethereal.pdb ../../editcap.pdb \
+	../../text2pcap.pdb ../../mergecap.pdb
 DLL=../../wiretap/wiretap-$(WTAP_VERSION).dll
 DOC=../../doc/ethereal.html		\
 	../../doc/tethereal.html	\
Index: packaging/nsis/ethereal.nsi.in
===================================================================
RCS file: /cvsroot/ethereal/packaging/nsis/ethereal.nsi.in,v
retrieving revision 1.8
diff -u -r1.8 ethereal.nsi.in
--- ethereal.nsi.in	2001/11/01 21:55:08	1.8
+++ ethereal.nsi.in	2001/12/11 14:16:34
@@ -128,6 +128,8 @@
 File "..\..\ethereal.pdb"
 File "..\..\tethereal.pdb"
 File "..\..\editcap.pdb"
+File "..\..\mergecap.pdb"
+File "..\..\text2pcap.pdb"
 SectionEnd
 
 SectionDivider
Index: plugins/Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/plugins/Makefile.nmake,v
retrieving revision 1.10
diff -u -r1.10 Makefile.nmake
--- Makefile.nmake	2001/07/19 21:30:16	1.10
+++ Makefile.nmake	2001/12/11 14:16:34
@@ -32,7 +32,7 @@
 
 
 clean:
-	rm -f plugin_api.obj
+	rm -f plugin_api.obj $(PDB_FILE)
 	cd gryphon
 	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
 	cd ../mgcp
Index: plugins/giop/Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/plugins/giop/Makefile.nmake,v
retrieving revision 1.3
diff -u -r1.3 Makefile.nmake
--- Makefile.nmake	2001/10/17 19:27:43	1.3
+++ Makefile.nmake	2001/12/11 14:16:34
@@ -25,5 +25,5 @@
 
 
 clean:
-	rm -f $(OBJECTS) cosnaming.dll cosnaming.exp cosnaming.lib
-	rm -f $(OBJECTS) coseventcomm.dll coseventcomm.exp coseventcomm.lib
+	rm -f $(OBJECTS) cosnaming.dll cosnaming.exp cosnaming.lib \
+	coseventcomm.dll coseventcomm.exp coseventcomm.lib $(PDB_FILE)
Index: plugins/gryphon/Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/plugins/gryphon/Makefile.nmake,v
retrieving revision 1.5
diff -u -r1.5 Makefile.nmake
--- Makefile.nmake	2000/10/11 07:35:02	1.5
+++ Makefile.nmake	2001/12/11 14:16:34
@@ -17,4 +17,4 @@
 	link -dll /out:gryphon.dll packet-gryphon.obj ..\plugin_api.obj
 
 clean:
-	rm -f $(OBJECTS) gryphon.dll gryphon.exp gryphon.lib
+	rm -f $(OBJECTS) gryphon.dll gryphon.exp gryphon.lib $(PDB_FILE)
Index: plugins/mgcp/Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/plugins/mgcp/Makefile.nmake,v
retrieving revision 1.2
diff -u -r1.2 Makefile.nmake
--- Makefile.nmake	2000/11/14 10:38:15	1.2
+++ Makefile.nmake	2001/12/11 14:16:35
@@ -18,4 +18,4 @@
 	$(GLIB_DIR)\glib-$(GLIB_VERSION).lib
 
 clean:
-	rm -f $(OBJECTS) mgcp.dll mgcp.exp mgcp.lib
+	rm -f $(OBJECTS) mgcp.dll mgcp.exp mgcp.lib $(PDB_FILE)
Index: tools/lemon/Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/tools/lemon/Makefile.nmake,v
retrieving revision 1.5
diff -u -r1.5 Makefile.nmake
--- Makefile.nmake	2001/11/09 09:22:07	1.5
+++ Makefile.nmake	2001/12/11 14:16:35
@@ -3,10 +3,10 @@
 
 CFLAGS=$(LOCAL_CFLAGS)
 
-{$S}.c{$O}.obj::
-   $(CC) $(CFLAGS) -Fd$O\ -c $<
+.c.obj::
+   $(CC) $(CFLAGS) -Fd.\ -c $<
 
 all : lemon.exe
 
 clean:
-	rm -f lemon.obj lemon.exe
+	rm -f lemon.obj lemon.exe $(PDB_FILE) lemon.pdb
Index: wiretap/Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/wiretap/Makefile.nmake,v
retrieving revision 1.23
diff -u -r1.23 Makefile.nmake
--- Makefile.nmake	2001/12/04 22:28:19	1.23
+++ Makefile.nmake	2001/12/11 14:16:35
@@ -9,8 +9,8 @@
 
 CFLAGS=-DHAVE_CONFIG_H /I$(GLIB_DIR) /I$(ZLIB_DIR) $(LOCAL_CFLAGS)
 
-{$S}.c{$O}.obj::
-   $(CC) $(cvarsdll) $(CFLAGS) -Fd$O\ -c $<
+.c.obj::
+   $(CC) $(cvarsdll) $(CFLAGS) -Fd.\ -c $<
 
 OBJECTS=ascend-grammar.obj \
 	ascend-scanner.obj \
@@ -73,4 +73,4 @@
 		wiretap-$(WTAP_VERSION).lib \
 		wiretap-$(WTAP_VERSION).exp \
 		wiretap-$(WTAP_VERSION).dll \
-		config.h
+		config.h $(PDB_FILE)
This message has been 'sanitized'.  This means that potentially
dangerous content has been rewritten or removed.  The following
log describes which actions were taken.

Sanitizer (start="1008080404"):
  Replaced MIME boundary: >>--Next_Part--<<
                    with: >>MIMEStream=_0+26372_49451240523429_71433202922<<
  Writer (pos="1190"):
    Total modifications so far: 1

  Part (pos="1236"):
    SanitizeFile (filename="unnamed.txt", mimetype="Text/Plain"):
      Match (rule="2"):
        Enforced policy: accept

  Part (pos="5517"):
    SanitizeFile (filename="Makefile.nmake.diff", mimetype="Text/Plain"):
      Match (rule="default"):
        Enforced policy: accept


Anomy 0.0.0 : Sanitizer.pm
$Id: Sanitizer.pm,v 1.32 2001/10/11 19:27:15 bre Exp $