• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/gawk -f
2
3## Copyright (C) 2012, 2015 Red Hat, Inc.
4##
5## This file is part of elfutils.
6##
7## This file is free software; you can redistribute it and/or modify
8## it under the terms of the GNU General Public License as published by
9## the Free Software Foundation; either version 3 of the License, or
10## (at your option) any later version.
11##
12## elfutils is distributed in the hope that it will be useful, but
13## WITHOUT ANY WARRANTY; without even the implied warranty of
14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15## GNU General Public License for more details.
16##
17## You should have received a copy of the GNU General Public License
18## along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20$1 == "enum" { set = ""; next }
21
22set == "" && $1 ~ /DW_([A-Z_]+)_([^ ]+)/ {
23  set = $1;
24  sub(/^DW_/, "", set);
25  sub(/_[^[:upper:]_].*$/, "", set);
26  if (set ~ /LANG_.+/) set = "LANG";
27}
28
29$1 ~ /DW([_A-Z]+)_([^ ]+)/ {
30  match($1, ("DW_" set "_([^ ]+)"), fields);
31  elt = fields[1];
32  if (set in DW)
33    DW[set] = DW[set] "," elt;
34  else
35    DW[set] = elt;
36}
37
38END {
39  print "/* Generated by config/known-dwarf.awk from libdw/dwarf.h contents.  */";
40  n = asorti(DW, sets);
41  for (i = 1; i <= n; ++i) {
42    set = sets[i];
43    if (what && what != set) continue;
44    split(DW[set], elts, ",");
45    m = asort(elts);
46    if (m == 0) continue;
47    print "\n#define DWARF_ALL_KNOWN_DW_" set " \\";
48    for (j = 1; j <= m; ++j) {
49      elt = elts[j];
50      if (elt ~ /(low?|hi|high)_user$/)
51	continue;
52      print "  DWARF_ONE_KNOWN_DW_" set " (" elt ", DW_" set "_" elt ") \\";
53    }
54    print "  /* End of DW_" set "_*.  */";
55  }
56}
57