File: at_list.awk

package info (click to toggle)
dwarfutils 20080409-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,352 kB
  • ctags: 2,713
  • sloc: ansic: 26,569; sh: 2,752; makefile: 285; awk: 147
file content (22 lines) | stat: -rw-r--r-- 552 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# print code to return attribute name from list of attrs in dwarf.h (the input)
# In case of a duplicate value, accept the first as definitive.
# dwarf2 had a couple ambiguities/mistakes in attribute spelling.
BEGIN {
	printf "static int list_of_attrs[] = {\n"
	used_pref["0"] = "";
}
{
	prefix = "DW_AT_"
	prefix_len = length(prefix)
	if ($1 == "#define" && substr($2,1,prefix_len) == prefix) {
		if ( used_pref[ $3] != $3 )  {
		   printf "\t%s,\n", $2
		   used_pref [$3] = $3 ;
	        }
	}
}
END {
	printf "\t0\n"		# last value
	printf "};\n"
}