findstr doesn't always find

J

jkwold

I'm converting 300+ MSVC6 projects to VS2005 and fighting with .def
files (hooray for APIs and customers !) and the changes in mangled
names (particularly for CString :) -- I've been depending on findstr
for much of the analysis, and just today found a case where the search
string wasn't always found. The string in question is:

?Initialize@CYpsBrowseIncludeDataDlg@@QAEXW4BrowseType@1@AAV?
$CStringT@GV?$StrTraitMFC_DLL@GV?$ChTraitsCRT@G@ATL@@

Note that that's not a full mangled name; I haven't found the actual
limit, but have taken to truncating strings longer than 115 chars as
findstr fails somewhere beyond that -- trivia. I'm launching findstr
as follows:

findstr /g:SR_req'd *def

The lengthy mangled name is one of 100 or so in the file SR_req'd (the
contents of which, incidentally, are sorted) -- it's about 40 lines
into that file (a collection of mangled names, all truncated at column
115). The subdir in which I run findstr has 357 *.def files, one of
which does contain that string.

If I truncate SR_req'd down to a mere 44 lines, then that mangled
name is found.

In the 100+ line /g:file case, numerous other matches are encountered
(it's not like nothing is found), including items both before and
after the not-found line -- I've not yet found rhyme or reason to what
is found and what is not.

I've got cygwin installed, so I'll see how its grep holds up.

Thoughts ?
Jon
 
M

Matthias Tacke

jkwold said:
I'm converting 300+ MSVC6 projects to VS2005 and fighting with .def
files (hooray for APIs and customers !) and the changes in mangled
names (particularly for CString :) -- I've been depending on findstr
for much of the analysis, and just today found a case where the search
string wasn't always found. The string in question is:

?Initialize@CYpsBrowseIncludeDataDlg@@QAEXW4BrowseType@1@AAV?
$CStringT@GV?$StrTraitMFC_DLL@GV?$ChTraitsCRT@G@ATL@@
....
Thoughts ?

Strange, AFAIK findstr uses regex mode by default. Several $ signs to
anchor at line end aren't valid.
Did you try with /L and if necessary /I switches ?

HTH
Matthias
 
J

jkwold

Yes, sorry -- forgot to mention that -- /L makes no difference, and I
skipped /I because I want the case-sensitive matching.

Jon
 
J

jkwold

cygwin's grep gave the proper results once I ensured that all 0x0d ==
CR were stripped from the relevant files -- as a bonus said grep
properly handled search strings longer than 115+ chars. Example:

grep -F -f SR_req\'d *def

Jon
 
H

Herb Martin

jkwold said:
cygwin's grep gave the proper results once I ensured that all 0x0d ==
CR were stripped from the relevant files -- as a bonus said grep
properly handled search strings longer than 115+ chars. Example:

grep -F -f SR_req\'d *def

Jon

This doesn't answer you question directly but Perl is practically
designed for such problems -- in many cases these changes become
litterally one line programs.

ActivePerl (.com) for Win32 is excellent.
 
F

foxidrive

I'm converting 300+ MSVC6 projects to VS2005 and fighting with .def
files (hooray for APIs and customers !) and the changes in mangled
names (particularly for CString :) -- I've been depending on findstr
for much of the analysis, and just today found a case where the search
string wasn't always found. The string in question is:

?Initialize@CYpsBrowseIncludeDataDlg@@QAEXW4BrowseType@1@AAV?
$CStringT@GV?$StrTraitMFC_DLL@GV?$ChTraitsCRT@G@ATL@@

Note that that's not a full mangled name; I haven't found the actual
limit, but have taken to truncating strings longer than 115 chars as
findstr fails somewhere beyond that -- trivia. I'm launching findstr
as follows:

findstr /g:SR_req'd *def

JFTR find has a larger buffer (of 1025 characters) than findstr, but is not
as capable, obviously.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

create dll problem 1

Top