1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,79 @@ 1.4 +// -*- mode: c++ -*- 1.5 + 1.6 +// Copyright (c) 2011, Google Inc. 1.7 +// All rights reserved. 1.8 +// 1.9 +// Redistribution and use in source and binary forms, with or without 1.10 +// modification, are permitted provided that the following conditions are 1.11 +// met: 1.12 +// 1.13 +// * Redistributions of source code must retain the above copyright 1.14 +// notice, this list of conditions and the following disclaimer. 1.15 +// * Redistributions in binary form must reproduce the above 1.16 +// copyright notice, this list of conditions and the following disclaimer 1.17 +// in the documentation and/or other materials provided with the 1.18 +// distribution. 1.19 +// * Neither the name of Google Inc. nor the names of its 1.20 +// contributors may be used to endorse or promote products derived from 1.21 +// this software without specific prior written permission. 1.22 +// 1.23 +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.24 +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1.25 +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1.26 +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1.27 +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.28 +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.29 +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1.30 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 1.31 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1.32 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 1.33 +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.34 + 1.35 +// dump_symbols.h: Read debugging information from an ELF file, and write 1.36 +// it out as a Breakpad symbol file. 1.37 + 1.38 +#ifndef COMMON_LINUX_DUMP_SYMBOLS_H__ 1.39 +#define COMMON_LINUX_DUMP_SYMBOLS_H__ 1.40 + 1.41 +#include <iostream> 1.42 +#include <string> 1.43 +#include <vector> 1.44 + 1.45 +#include "common/symbol_data.h" 1.46 +#include "common/using_std_string.h" 1.47 +#include "google_breakpad/common/breakpad_types.h" 1.48 + 1.49 +namespace google_breakpad { 1.50 + 1.51 +class Module; 1.52 + 1.53 +// Find all the debugging information in OBJ_FILE, an ELF executable 1.54 +// or shared library, and write it to SYM_STREAM in the Breakpad symbol 1.55 +// file format. 1.56 +// If OBJ_FILE has been stripped but contains a .gnu_debuglink section, 1.57 +// then look for the debug file in DEBUG_DIRS. 1.58 +// SYMBOL_DATA allows limiting the type of symbol data written. 1.59 +bool WriteSymbolFile(const string &obj_file, 1.60 + const std::vector<string>& debug_dirs, 1.61 + SymbolData symbol_data, 1.62 + std::ostream &sym_stream); 1.63 + 1.64 +// As above, but simply return the debugging information in MODULE 1.65 +// instead of writing it to a stream. The caller owns the resulting 1.66 +// Module object and must delete it when finished. 1.67 +bool ReadSymbolData(const string& obj_file, 1.68 + const std::vector<string>& debug_dirs, 1.69 + SymbolData symbol_data, 1.70 + Module** module); 1.71 + 1.72 +// Same as ReadSymbolData, except don't try to open the file; instead 1.73 +// just use the in-memory data (mapped image of it) located at OBJ_FILE. 1.74 +bool ReadSymbolDataInternal(const uint8_t* obj_file, 1.75 + const string& obj_filename, 1.76 + const std::vector<string>& debug_dirs, 1.77 + SymbolData symbol_data, 1.78 + Module** module); 1.79 + 1.80 +} // namespace google_breakpad 1.81 + 1.82 +#endif // COMMON_LINUX_DUMP_SYMBOLS_H__