summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2004-01-11 21:22:33 -0500
committerNathan Binkert <binkertn@umich.edu>2004-01-11 21:22:33 -0500
commitb4301c652cf09a7464a360a403cb25ad214909f5 (patch)
treef24311aef29908485ce7059a72bc6eec25d90035 /base
parenta3691fe09e663871d4dd46c4fcc05407ac8c448a (diff)
parentf8ed615bc65139076289e8af4bc6c7908aae4aa8 (diff)
downloadgem5-b4301c652cf09a7464a360a403cb25ad214909f5.tar.xz
Merge zizzer.eecs.umich.edu:/bk/m5
into ziff.eecs.umich.edu:/z/binkertn/research/m5/latest --HG-- extra : convert_revision : bff2fb78e205f327ce8d04f3ae1b2352857ab824
Diffstat (limited to 'base')
-rw-r--r--base/cprintf.cc39
-rw-r--r--base/cprintf.hh2
-rw-r--r--base/cprintf_formats.hh19
-rw-r--r--base/loader/elf_object.hh7
4 files changed, 33 insertions, 34 deletions
diff --git a/base/cprintf.cc b/base/cprintf.cc
index af3b26a57..5796a712b 100644
--- a/base/cprintf.cc
+++ b/base/cprintf.cc
@@ -45,8 +45,6 @@ ArgList::dump(const string &format)
stream->fill(' ');
stream->flags((ios::fmtflags)0);
- Format fmt;
-
while (*p) {
switch (*p) {
case '%': {
@@ -56,12 +54,7 @@ ArgList::dump(const string &format)
continue;
}
- if (objects.empty())
- format_invalid(*stream);
-
- Base *data = objects.front();
-
- fmt.clear();
+ Format fmt;
bool done = false;
bool end_number = false;
bool have_precision = false;
@@ -205,18 +198,26 @@ ArgList::dump(const string &format)
}
}
- ios::fmtflags saved_flags = stream->flags();
- char old_fill = stream->fill();
- int old_precision = stream->precision();
+ if (!objects.empty())
+ {
+ Base *data = objects.front();
+ objects.pop_front();
+
+ ios::fmtflags saved_flags = stream->flags();
+ char old_fill = stream->fill();
+ int old_precision = stream->precision();
- data->process(*stream, fmt);
+ data->process(*stream, fmt);
- stream->flags(saved_flags);
- stream->fill(old_fill);
- stream->precision(old_precision);
+ stream->flags(saved_flags);
+ stream->fill(old_fill);
+ stream->precision(old_precision);
+
+ delete data;
+ } else {
+ *stream << "<missing arg for format>";
+ }
- delete data;
- objects.pop_front();
++p;
}
break;
@@ -241,10 +242,10 @@ ArgList::dump(const string &format)
}
while (!objects.empty()) {
+ *stream << "<extra arg>";
Base *data = objects.front();
- data->process(*stream, fmt);
- delete data;
objects.pop_front();
+ delete data;
}
}
diff --git a/base/cprintf.hh b/base/cprintf.hh
index 8360d227c..ac34cd252 100644
--- a/base/cprintf.hh
+++ b/base/cprintf.hh
@@ -75,7 +75,7 @@ class ArgList
break;
default:
- format_invalid(out);
+ out << "<bad format>";
break;
}
}
diff --git a/base/cprintf_formats.hh b/base/cprintf_formats.hh
index 1e5de4fdf..b921c0506 100644
--- a/base/cprintf_formats.hh
+++ b/base/cprintf_formats.hh
@@ -43,8 +43,10 @@ struct Format
int precision;
int width;
- Format() { }
- void clear() {
+ Format() { clear(); }
+
+ void clear()
+ {
alternate_form = false;
flush_left = false;
print_sign = false;
@@ -58,15 +60,6 @@ struct Format
}
};
-inline void
-format_invalid(std::ostream &out)
-{
- using namespace std;
-
- out << "format invalid!!!" << endl;
-}
-
-
template <typename T>
inline void
_format_char(std::ostream &out, const T& data, Format &fmt)
@@ -233,7 +226,7 @@ _format_string(std::ostream &out, const T& data, Format &fmt)
template <typename T>
inline void
format_char(std::ostream &out, const T& data, Format &fmt)
-{ format_invalid(out); }
+{ out << "<bad arg type for char format>"; }
inline void
format_char(std::ostream &out, char data, Format &fmt)
@@ -329,7 +322,7 @@ format_integer(std::ostream &out, unsigned long long data, Format &fmt)
template <typename T>
inline void
format_float(std::ostream &out, const T& data, Format &fmt)
-{ format_invalid(out); }
+{ out << "<bad arg type for float format>"; }
inline void
format_float(std::ostream &out, float data, Format &fmt)
diff --git a/base/loader/elf_object.hh b/base/loader/elf_object.hh
index afd4cd62b..9f0385d86 100644
--- a/base/loader/elf_object.hh
+++ b/base/loader/elf_object.hh
@@ -29,8 +29,13 @@
#ifndef __ELF_OBJECT_HH__
#define __ELF_OBJECT_HH__
-#include <libelf/gelf.h>
+/* Because of the -Wundef flag we have to do this */
+#define __LIBELF_INTERNAL__ 0
+#define __LIBELF64_LINUX 1
+#define __LIBELF_NEED_LINK_H 0
+
#include <libelf/libelf.h>
+#include <libelf/gelf.h>
#include "base/loader/object_file.hh"
class ElfObject : public ObjectFile