summaryrefslogtreecommitdiffstats
path: root/lib/system.h
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2012-06-06 10:57:48 +0200
committerMark Wielaard <[email protected]>2012-06-06 10:59:19 +0200
commit236f2f5f2122b2e1981f2e6f3ac2e7047b44d907 (patch)
tree79018260dfdd0e79e4ef7706d4e988898f87e44e /lib/system.h
parent99cd353bdb68e74d5dad5869b2fa6b4a4aaefd72 (diff)
parentde2ed97f33139af5c7a0811e4ec66fc896a13cf2 (diff)
Merge branch 'master' into dwarf
Signed-off-by: Richard Fontana <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'lib/system.h')
-rw-r--r--lib/system.h111
1 files changed, 71 insertions, 40 deletions
diff --git a/lib/system.h b/lib/system.h
index 10b4734a..9ac01f89 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -1,56 +1,49 @@
/* Declarations for common convenience functions.
- Copyright (C) 2006, 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2006-2011 Red Hat, Inc.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under an Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) and to distribute linked
- combinations including the two. Non-GPL Code permitted under this
- exception must only link to the code of Red Hat elfutils through those
- well defined interfaces identified in the file named EXCEPTION found in
- the source code files (the "Approved Interfaces"). The files of Non-GPL
- Code may instantiate templates or use macros or inline functions from
- the Approved Interfaces without causing the resulting work to be covered
- by the GNU General Public License. Only Red Hat, Inc. may make changes
- or additions to the list of Approved Interfaces. Red Hat's grant of
- this exception is conditioned upon your not adding any new exceptions.
- If you wish to add a new Approved Interface or exception, please contact
- Red Hat. You must obey the GNU General Public License in all respects
- for all of the Red Hat elfutils code and other code used in conjunction
- with Red Hat elfutils except the Non-GPL Code covered by this exception.
- If you modify this file, you may extend this exception to your version
- of the file, but you are not obligated to do so. If you do not wish to
- provide this exception without modification, you must delete this
- exception statement from your version and license this file solely under
- the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifndef LIB_SYSTEM_H
#define LIB_SYSTEM_H 1
+#include <argp.h>
#include <stddef.h>
#include <stdint.h>
+#include <endian.h>
+#include <byteswap.h>
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# define LE32(n) (n)
+# define BE32(n) bswap_32 (n)
+#elif __BYTE_ORDER == __BIG_ENDIAN
+# define BE32(n) (n)
+# define LE32(n) bswap_32 (n)
+#else
+# error "Unknown byte order"
+#endif
extern void *xmalloc (size_t) __attribute__ ((__malloc__));
extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
@@ -90,4 +83,42 @@ extern int crc32_file (int fd, uint32_t *resp);
#define ARGP_PROGRAM_BUG_ADDRESS_DEF \
const char *const apba__ __asm ("argp_program_bug_address")
+
+/* The demangler from libstdc++. */
+extern char *__cxa_demangle (const char *mangled_name, char *output_buffer,
+ size_t *length, int *status);
+
+
+
+/* Color handling. */
+
+/* Command line parser. */
+extern const struct argp color_argp;
+
+/* Coloring mode. */
+enum color_enum
+ {
+ color_never = 0,
+ color_always,
+ color_auto
+ } __attribute__ ((packed));
+extern enum color_enum color_mode;
+
+/* Colors to use for the various components. */
+extern char *color_address;
+extern char *color_bytes;
+extern char *color_mnemonic;
+extern char *color_operand1;
+extern char *color_operand2;
+extern char *color_operand3;
+extern char *color_label;
+extern char *color_undef;
+extern char *color_undef_tls;
+extern char *color_undef_weak;
+extern char *color_symbol;
+extern char *color_tls;
+extern char *color_weak;
+
+extern const char color_off[];
+
#endif /* system.h */