-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add little test harness to measure and compare quality of linenumber …
…information preserved by clang. It produces .lineinfo file, for example .|int main() { | int Array[100][200], i, j; +| double sum = 0.0; | .| for (i=0; i < 100; i+=2) .| for (j=0; j < 200; j++) .| Array[i][j] = 0; -| test_indvars(Array[0], Array); | x| for (i=0; i < 100; i+=2) x| for (j=0; j < 200; j++) .| sum += Array[i][j]; | .| printf("Checksum = %.0lf\n", sum); | -| return 0; .|} Here, . in first column indicates both clang and base compiler preserves line number information for this line. + in first column indicates only clang preserves line number information for this line. - in first column indicates neigther clang nor base compiler preserves line number information for this line. x in first column indicates clang does not preserve line number information for this line. CC is base compiler and LCC is clang. OPTFLAGS controls the optimization level. git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@133276 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Devang Patel
committed
Jun 17, 2011
1 parent
6dde818
commit ebb738e
Showing
4 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/usr/bin/python | ||
|
||
import os | ||
import sys | ||
|
||
DBG_OUTPUT_FILE="Output/" + sys.argv[1] + ".dbg.ml" | ||
OPT_DBG_OUTPUT_FILE="Output/" + sys.argv[1] + ".dbg.opt.ml" | ||
NATIVE_DBG_OUTPUT_FILE="Output/" + sys.argv[1] + ".native.dbg.ml" | ||
NATIVE_OPT_DBG_OUTPUT_FILE="Output/" + sys.argv[1] + ".native.dbg.opt.ml" | ||
XFAIL_FILE=sys.argv[2] + "/lineinfo.xfail" | ||
|
||
REPORT_FILE="Output/" + sys.argv[1] + ".dbg.missing_lines.report.txt" | ||
|
||
def read_inputfile(filename, dict): | ||
f = open(filename, "r") | ||
lines = f.readlines() | ||
for l in range(len(lines)): | ||
columns = lines[l].split() | ||
s = dict.get(columns[0]) | ||
if s is None: | ||
s = set() | ||
s.add(columns[1]) | ||
dict[columns[0]] = s | ||
f.close() | ||
return | ||
|
||
dbg_lines = {} | ||
read_inputfile(DBG_OUTPUT_FILE, dbg_lines) | ||
|
||
dbg_opt_lines = {} | ||
read_inputfile(OPT_DBG_OUTPUT_FILE, dbg_opt_lines) | ||
|
||
native_dbg_lines = {} | ||
read_inputfile(NATIVE_DBG_OUTPUT_FILE, native_dbg_lines) | ||
|
||
native_dbg_opt_lines = {} | ||
read_inputfile(NATIVE_OPT_DBG_OUTPUT_FILE, native_dbg_opt_lines) | ||
|
||
xfailed_lines = {} | ||
read_inputfile(XFAIL_FILE, xfailed_lines) | ||
|
||
dbg_line_items = dbg_lines.items() | ||
for f in range(len(dbg_line_items)): | ||
fname = dbg_line_items[f][0] | ||
fset = dbg_line_items[f][1] | ||
optset = dbg_opt_lines.get(fname) | ||
nativeoptset = native_dbg_opt_lines.get(fname) | ||
xfailedset = xfailed_lines.get(os.path.basename(fname)) | ||
if optset is not None: | ||
src = open(fname, "r") | ||
srclines = src.readlines() | ||
src_output = open("Output/" + sys.argv[1] + ".lineinfo", "w") | ||
for l in range(len(srclines)): | ||
l1 = l + 1 | ||
l1s = str(l1) | ||
if l1s in fset: | ||
if l1s in optset: | ||
if nativeoptset is not None and l1s in nativeoptset: | ||
src_output.write(".|") | ||
else: | ||
src_output.write("+|") | ||
else: | ||
if nativeoptset is not None and l1s in nativeoptset: | ||
if xfailedset is not None and l1s in xfailedset: | ||
src_output.write(" |") | ||
else: | ||
src_output.write("x|") | ||
else: | ||
src_output.write("-|") | ||
else: | ||
src_output.write(" |") | ||
src_output.write(srclines[l]) | ||
src.close() | ||
src_output.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
dwarfdump Output/$1.dbg.dSYM/ -e --debug-line | grep "^0x" | awk '{if ($3) prev=$3; print basename prev," ",$2}' |sort |uniq > Output/$1.dbg.ml; | ||
dwarfdump Output/$1.dbg.opt.dSYM/ -e --debug-line | grep "^0x" | awk '{if ($3) prev=$3; print basename prev," ",$2}' |sort |uniq > Output/$1.dbg.opt.ml; | ||
dwarfdump Output/$1.native.dbg.dSYM/ -e --debug-line | grep "^0x" | awk '{if ($3) prev=$3; print basename prev," ",$2}' |sort |uniq > Output/$1.native.dbg.ml; | ||
dwarfdump Output/$1.native.dbg.opt.dSYM/ -e --debug-line | grep "^0x" | awk '{if ($3) prev=$3; print basename prev," ",$2}' |sort |uniq > Output/$1.native.dbg.opt.ml; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
##===- TEST.lineinfo.Makefile -----------------------------*- Makefile -*--===## | ||
# | ||
# This test is used to measure quality of debugging information. | ||
# | ||
##===----------------------------------------------------------------------===## | ||
|
||
CURDIR := $(shell cd .; pwd) | ||
PROGDIR := $(PROJ_SRC_ROOT) | ||
RELDIR := $(subst $(PROGDIR),,$(CURDIR)) | ||
COLLECTOR := $(PROJ_SRC_ROOT)/CollectDebugInfoUsingLLDB.py | ||
|
||
REPORTS_TO_GEN := dbg | ||
REPORTS_SUFFIX := $(addsuffix .report.txt, $(REPORTS_TO_GEN)) | ||
|
||
Output/%.bp: %.c Output/.dir | ||
$(LCC) $(CPPFLAGS) $(CFLAGS) -g -c -emit-llvm $< -o $@.bc | ||
$(LOPT) -print-breakpoints-for-testing $@.bc -o $@ | ||
|
||
Output/%.bp: %.cpp Output/.dir | ||
$(LCXX) $(CPPFLAGS) $(CFLAGS) -g -c -emit-llvm $< -o $@.bc | ||
$(LOPT) -print-breakpoints-for-testing $@.bc -o $@ | ||
|
||
Output/%.bp: %.m Output/.dir | ||
$(LCC) $(CPPFLAGS) $(CFLAGS) -g -c -emit-llvm $< -o $@.bc | ||
$(LOPT) -print-breakpoints-for-testing $@.bc -o $@ | ||
|
||
Output/%.bp: %.mm Output/.dir | ||
$(LCXX) $(CPPFLAGS) $(CFLAGS) -g -c -emit-llvm $< -o $@.bc | ||
$(LOPT) -print-breakpoints-for-testing $@.bc -o $@ | ||
|
||
$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \ | ||
test.$(TEST).%: Output/%.bp Output/%.dbg Output/%.dbg.opt Output/%.native.dbg Output/%.native.dbg.opt | ||
@-is_skip=0; \ | ||
if test "$*" == "reversefile"; then \ | ||
is_skip=1; \ | ||
fi; \ | ||
if test "$*" == "spellcheck"; then \ | ||
is_skip=1; \ | ||
fi; \ | ||
if test "$*" == "sumcol"; then \ | ||
is_skip=1; \ | ||
fi; \ | ||
if test "$*" == "wc"; then \ | ||
is_skip=1; \ | ||
fi; \ | ||
if test "$*" == "wordfreq"; then \ | ||
is_skip=1; \ | ||
fi; \ | ||
if test "$*" == "exptree"; then \ | ||
is_skip=1; \ | ||
fi; \ | ||
if test "$*" == "ray"; then \ | ||
is_skip=1; \ | ||
fi; \ | ||
if test "$*" == "oscar"; then \ | ||
is_skip=1; \ | ||
fi; \ | ||
if test "$*" == "spirit"; then \ | ||
is_skip=1; \ | ||
fi; \ | ||
if test $$is_skip == 0; then \ | ||
$(PROJ_SRC_ROOT)/PrintLineNo.sh $*; \ | ||
$(PROJ_SRC_ROOT)/FindMissingLineNo.py $* $(PROJ_SRC_ROOT);\ | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sse.shift.c 9 |