Mark Wielaard | 387998b | 2011-10-31 15:01:50 +0100 | [diff] [blame] | 1 | #!/bin/gawk -f |
Roland McGrath | 5513e64 | 2009-01-11 01:35:11 -0800 | [diff] [blame] | 2 | |
Mark Wielaard | de2ed97 | 2012-06-05 17:15:16 +0200 | [diff] [blame] | 3 | ## Copyright (C) 2012 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 | |
Roland McGrath | 97b12d0 | 2009-01-22 03:08:46 -0800 | [diff] [blame] | 20 | $1 == "enum" { set = ""; next } |
| 21 | |
| 22 | set == "" && $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]; |
Roland McGrath | 5513e64 | 2009-01-11 01:35:11 -0800 | [diff] [blame] | 32 | if (set in DW) |
| 33 | DW[set] = DW[set] "," elt; |
| 34 | else |
| 35 | DW[set] = elt; |
| 36 | if ($NF == "*/" && $4 == "/*") { |
| 37 | c = $5; |
| 38 | for (i = 6; i < NF; ++i) c = c " " $i; |
| 39 | comment[set, elt] = c; |
| 40 | } |
| 41 | } |
Roland McGrath | 97b12d0 | 2009-01-22 03:08:46 -0800 | [diff] [blame] | 42 | |
Roland McGrath | 5513e64 | 2009-01-11 01:35:11 -0800 | [diff] [blame] | 43 | END { |
Mark Wielaard | 1da612b | 2012-07-19 23:31:45 +0200 | [diff] [blame] | 44 | print "/* Generated by config/known-dwarf.awk from libdw/dwarf.h contents. */"; |
Roland McGrath | 5513e64 | 2009-01-11 01:35:11 -0800 | [diff] [blame] | 45 | n = asorti(DW, sets); |
| 46 | for (i = 1; i <= n; ++i) { |
| 47 | set = sets[i]; |
| 48 | if (what && what != set) continue; |
Roland McGrath | 5513e64 | 2009-01-11 01:35:11 -0800 | [diff] [blame] | 49 | split(DW[set], elts, ","); |
| 50 | m = asort(elts); |
| 51 | lo = hi = ""; |
Roland McGrath | 97b12d0 | 2009-01-22 03:08:46 -0800 | [diff] [blame] | 52 | if (m == 0) continue; |
| 53 | print "\n#define ALL_KNOWN_DW_" set " \\"; |
Roland McGrath | 5513e64 | 2009-01-11 01:35:11 -0800 | [diff] [blame] | 54 | for (j = 1; j <= m; ++j) { |
| 55 | elt = elts[j]; |
| 56 | if (elt ~ /(lo|low)_user$/) { |
| 57 | lo = elt; |
| 58 | continue; |
| 59 | } |
| 60 | if (elt ~ /(hi|high)_user$/) { |
| 61 | hi = elt; |
| 62 | continue; |
| 63 | } |
| 64 | if (comment[set, elt]) |
| 65 | print " ONE_KNOWN_DW_" set "_DESC (" elt ", DW_" set "_" elt \ |
| 66 | ", \"" comment[set, elt] "\") \\"; |
| 67 | else |
| 68 | print " ONE_KNOWN_DW_" set " (" elt ", DW_" set "_" elt ") \\"; |
| 69 | } |
| 70 | print " /* End of DW_" set "_*. */"; |
| 71 | } |
| 72 | } |