[llvm-commits] CVS: llvm/lib/Reoptimizer/Inst/mkexcl/mkexcl.cpp
Joel Stanley
jstanley at cs.uiuc.edu
Sun May 4 16:09:07 PDT 2003
Changes in directory llvm/lib/Reoptimizer/Inst/mkexcl:
mkexcl.cpp updated: 1.3 -> 1.4
---
Log message:
The instrumentation exclusion set is now working.
---
Diffs of the changes:
Index: llvm/lib/Reoptimizer/Inst/mkexcl/mkexcl.cpp
diff -u llvm/lib/Reoptimizer/Inst/mkexcl/mkexcl.cpp:1.3 llvm/lib/Reoptimizer/Inst/mkexcl/mkexcl.cpp:1.4
--- llvm/lib/Reoptimizer/Inst/mkexcl/mkexcl.cpp:1.3 Sun May 4 15:01:30 2003
+++ llvm/lib/Reoptimizer/Inst/mkexcl/mkexcl.cpp Sun May 4 16:16:17 2003
@@ -3,28 +3,18 @@
// date: Wed Apr 30 17:19:23 CDT 2003
// fileid: mkexcl.cpp
// purpose: Provides the 'mkexcl' command-line utility. This utility reads the input
-// ELF files and dumps a C++ file to stdout that, when compiled, populates a set
-// with the symbol names contained in the object files. This command-line utility is
-// intended to work as part of the build process for the Reoptimizer-based performance
-// instrumentation binary editing library.
+// ELF files (or archives containing ELF files) and dumps a C++ file to stdout that,
+// can be used to populate a set with the symbol names contained in the object files.
+// This command-line utility is intended to work as part of the build process for the
+// Reoptimizer-based performance instrumentation binary editing library.
#include <iostream>
#include "llvm/Reoptimizer/Inst/ElfReader.h"
-#if 0
-#include <ar.h> // test
-#include <stdio.h> // test
-#include <sys/types.h> // test
-#include <sys/stat.h> //test
-#include <fcntl.h>// test
-#include <unistd.h> //test
-#endif
-
-using std::cerr;
+using std::cout;
using std::endl;
-// SparcV9 word width is 4 bytes
-#define INST_WIDTH 4
+#define INST_WIDTH 4 // SparcV9 word width is 4 bytes
int main(int argc, char** argv)
{
@@ -32,56 +22,23 @@
std::string funcName;
std::pair<uint64_t, uint64_t> range;
+ cout << "#ifndef _INCLUDED_MKEXCL_H" << endl
+ << "#define _INCLUDED_MKEXCL_H" << endl << endl
+ << "#include <set>" << endl
+ << "#include <string> " << endl << endl
+ << "void makeExcludedSymbolSet(std::set<std::string>& set)" << endl
+ << "{" << endl;
+
for(int i = 1; i < argc; ++i) {
- cerr << argv[i] << " contains the following symbols:" << endl;
-
ElfReader reader(argv[i]);
- while(reader.findNextSymbol(funcName, range, INST_WIDTH)) {
- cerr << funcName << endl;
- }
+ while(reader.findNextSymbol(funcName, range, INST_WIDTH))
+ cout << " set.insert(\"" << funcName << "\");" << endl;
}
+ cout << "}" << endl << endl
+ << "#endif // _INCLUDED_MKEXCL_H" << endl;
}
else
- cerr << "Usage: " << argv[0] << " [ELF Object File]..." << endl;
+ std::cerr << "Usage: " << argv[0] << " [ELF Object File or Archive]..." << endl;
return 0;
}
-
-#if 0
-// Test -- assume that this is an archive file
-int fd = open(argv[i], O_RDONLY);
-assert(fd);
-
-char magicString[SARMAG];
-unsigned rdcnt = read(fd, magicString, SARMAG);
-assert(rdcnt == SARMAG);
-
-cerr << "magic string is " << magicString << endl;
-
-struct ar_hdr arhdr;
-rdcnt = read(fd, &arhdr, sizeof(struct ar_hdr));
-assert(rdcnt == sizeof(struct ar_hdr));
-
-cerr << "ar_name is: " << arhdr.ar_name << endl << endl;
-cerr << "===" << endl;
-cerr << "ar_size is: " << arhdr.ar_size << endl << endl;
-
-// End test
-
-#endif
-
-
-#if 0
-
-/* Read until the connection goes away or we get the amount of data we want */
-while(byte_count < msg_size && (n = read(socket_fd, buffy, BUF_SIZE - 1)) > 0)
-{
-
- byte_count += n;
-
- buffy[n] = '\0';
-
- fputs(buffy, stdout);
-
-}
-#endif
More information about the llvm-commits
mailing list