RDK Documentation (Open Sourced RDK Components)
breakpadWrapper.cpp
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 #ifndef DISABLE_BREAKPAD
20 #include <client/linux/handler/exception_handler.h>
21 #include "breakpad_wrapper.h"
22 #include "rfcapi.h"
23 
24 // called by 'google_breakpad::ExceptionHandler' on every crash
25 namespace
26 {
27 bool breakpadCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded)
28 {
29  (void) descriptor;
30  (void) context;
31  return succeeded;
32 }
33 // Instantiate only one 'google_breakpad::ExceptionHandler'
34 // - "/opt/minidumps" is canonical path that should be in sync with uploadDumps.sh script
35 extern "C" void installExceptionHandler()
36 {
37  static google_breakpad::ExceptionHandler* excHandler = NULL;
38  delete excHandler;
39  RFC_ParamData_t secValue;
40  std::string minidump_path;
41  WDMP_STATUS status = getRFCParameter("SecureCoreFile", "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SecDump.Enable", &secValue);
42  if ( ( WDMP_SUCCESS == status ) && ( 0 == strncmp(secValue.value, "falsee", 5) ) )
43  {
44  ///RFC Settings for SecureDump is : false
45  minidump_path = "/opt/minidumps";
46  }
47  else
48  {
49  //"RFC Settings for SecureDump is : true
50  minidump_path = "/opt/secure/minidumps";
51  }
52  google_breakpad::MinidumpDescriptor descriptor(minidump_path.c_str());
53  excHandler = new google_breakpad::ExceptionHandler(descriptor, NULL, breakpadCallback, NULL, true, -1);
54 }
55 }
56 #endif
57