libcsdbg  1.28
C++ exception (and generic) stack trace debug library
streambuf & csdbg::streambuf::header ( )

Append LDP headers to the buffer.

The appended headers are for:

  1. executable absolute path
  2. process ID
  3. thread ID
  4. timestamp (in microseconds)

Each header is formatted as 'name: value\r\n'. All the numeric values are hexadecimal. In LDP, the header section is terminated with a double \r\n followed by the message body (trace data). This method just appends the four headers (not the extra \r\n delimiter) to allow for custom headers before the trace data (exception headers, custom OEM headers e.t.c)

Definition at line 248 of file streambuf.cpp.

References csdbg::string::append(), and csdbg::util::exec_path().

249 {
250  const i8 *path = util::exec_path();
252  struct timeval now;
253  gettimeofday(&now, NULL);
254  u64 tstamp = static_cast<u64> (now.tv_sec) * 10e+5 + now.tv_usec;
256  try {
257  append("path: %s\r\n", path);
258  append("pid: %x\r\n", getpid());
259  append("tid: %lx\r\n", pthread_self());
260  append("tstamp: %lx\r\n", tstamp);
262  delete[] path;
263  return *this;
264  }
266  catch (...) {
267  delete[] path;
268  throw;
269  }
270 }
virtual string & append(const string &)
Append a string.
Definition: string.cpp:404
static const i8 * exec_path()
Get the absolute path of the executable.
Definition: util.cpp:87
char i8
8-bit signed integer
Definition: config.hpp:72
unsigned long long u64
64-bit unsigned integer
Definition: config.hpp:107

+ Here is the call graph for this function: