comparison packages/language/cxx/ustl/current/src/bktrace.cpp @ 3152:4885e0722884

* include/*: * src/*: * tests/*: * HISTORY: * LICENSE: Updated to uSTL 1.6 sources.
author sergeig
date Wed, 04 Apr 2012 18:51:57 +0000
parents 9e1cb7863bef
children
comparison
equal deleted inserted replaced
3151:e1cec8d66444 3152:4885e0722884
1 // This file is part of the uSTL library, an STL implementation. 1 // This file is part of the uSTL library, an STL implementation.
2 // 2 //
3 // Copyright (c) 2006-2009 by Mike Sharov <msharov@users.sourceforge.net> 3 // Copyright (c) 2006 by Mike Sharov <msharov@users.sourceforge.net>
4 // This file is free software, distributed under the MIT License. 4 // This file is free software, distributed under the MIT License.
5 5
6 #include "bktrace.h" 6 #include "bktrace.h"
7 #include "sostream.h" 7 #include "sostream.h"
8 #include "mistream.h" 8 #include "mistream.h"
107 } 107 }
108 108
109 /// Reads the object from stream \p is. 109 /// Reads the object from stream \p is.
110 void CBacktrace::read (istream& is) 110 void CBacktrace::read (istream& is)
111 { 111 {
112 assert (is.aligned (alignof (m_Addresses[0])) && "Backtrace object contains pointers and must be void* aligned"); 112 assert (is.aligned (stream_align_of (m_Addresses[0])) && "Backtrace object contains pointers and must be void* aligned");
113 is >> m_nFrames >> m_SymbolsSize; 113 is >> m_nFrames >> m_SymbolsSize;
114 nfree (m_Symbols); 114 nfree (m_Symbols);
115 m_Symbols = (char*) malloc (m_SymbolsSize + 1); 115 m_Symbols = (char*) malloc (m_SymbolsSize + 1);
116 is.read (m_Symbols, m_SymbolsSize); 116 is.read (m_Symbols, m_SymbolsSize);
117 m_Symbols [m_SymbolsSize] = 0; 117 m_Symbols [m_SymbolsSize] = 0;
120 } 120 }
121 121
122 /// Writes the object to stream \p os. 122 /// Writes the object to stream \p os.
123 void CBacktrace::write (ostream& os) const 123 void CBacktrace::write (ostream& os) const
124 { 124 {
125 assert (os.aligned (alignof (m_Addresses[0])) && "Backtrace object contains pointers and must be void* aligned"); 125 assert (os.aligned (stream_align_of (m_Addresses[0])) && "Backtrace object contains pointers and must be void* aligned");
126 os << m_nFrames << m_SymbolsSize; 126 os << m_nFrames << m_SymbolsSize;
127 os.write (m_Symbols, m_SymbolsSize); 127 os.write (m_Symbols, m_SymbolsSize);
128 os.align(); 128 os.align();
129 os.write (m_Addresses, m_nFrames * sizeof(void*)); 129 os.write (m_Addresses, m_nFrames * sizeof(void*));
130 } 130 }