From 607b9a6566527eb49172311b08538ac5c757f1ae Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Mon, 22 Jul 2019 21:29:39 +0200 Subject: [PATCH] Revert "Use ecm_qt_declare_logging_category" It's missing stuff to work properly. Revert until I figured that out This reverts commit 8a118a6fae5b83ed9ad66cc7c91d3de34e194a9f. --- CMakeLists.txt | 1 - core/CMakeLists.txt | 8 +------ core/core_debug.cpp | 40 +++++++++++++++++++++++++++++++++++ core/core_debug.h | 32 ++++++++++++++++++++++++++++ interfaces/CMakeLists.txt | 7 ------ interfaces/devicesmodel.cpp | 2 ++ interfaces/interfaces_debug.h | 28 ++++++++++++++++++++++++ 7 files changed, 103 insertions(+), 15 deletions(-) create mode 100644 core/core_debug.cpp create mode 100644 core/core_debug.h create mode 100644 interfaces/interfaces_debug.h diff --git a/CMakeLists.txt b/CMakeLists.txt index b4d6753f0..a87ad831a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,6 @@ include(ECMAddTests) include(ECMSetupVersion) include(ECMInstallIcons) include(FeatureSummary) -include(ECMQtDeclareLoggingCategory) include(GenerateExportHeader) include(KDEConnectMacros.cmake) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index db2167937..b5ccbde81 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -37,16 +37,10 @@ set(kdeconnectcore_SRCS compositefiletransferjob.cpp daemon.cpp device.cpp + core_debug.cpp notificationserverinfo.cpp ) -ecm_qt_declare_logging_category( - kdeconnectcore_SRCS - HEADER core_debug.h - IDENTIFIER KDECONNECT_CORE - CATEGORY_NAME kdeconnect.core -) - add_library(kdeconnectcore ${kdeconnectcore_SRCS}) target_include_directories(kdeconnectcore PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) diff --git a/core/core_debug.cpp b/core/core_debug.cpp new file mode 100644 index 000000000..c82f65d73 --- /dev/null +++ b/core/core_debug.cpp @@ -0,0 +1,40 @@ +/** + * Copyright 2013 Albert Vaca + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "core_debug.h" + +Q_LOGGING_CATEGORY(KDECONNECT_CORE, "kdeconnect.core") + +#if defined(__GNU_LIBRARY__) +#include +#include +#include +#endif + +void logBacktrace() +{ +#if defined(__GNU_LIBRARY__) + void* array[32]; + size_t size = backtrace (array, 32); + char** strings = backtrace_symbols (array, size); + backtrace_symbols_fd(array, size, STDERR_FILENO); + free (strings); +#endif +} diff --git a/core/core_debug.h b/core/core_debug.h new file mode 100644 index 000000000..3daf0f725 --- /dev/null +++ b/core/core_debug.h @@ -0,0 +1,32 @@ +/** + * Copyright 2013 Albert Vaca + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef CORE_DEBUG_H +#define CORE_DEBUG_H + +#include + +#include "kdeconnectcore_export.h" + +KDECONNECTCORE_EXPORT Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_CORE) + +void logBacktrace(); + +#endif //CORE_DEBUG_H diff --git a/interfaces/CMakeLists.txt b/interfaces/CMakeLists.txt index 398ba1a31..f0c000ee7 100644 --- a/interfaces/CMakeLists.txt +++ b/interfaces/CMakeLists.txt @@ -20,13 +20,6 @@ set(libkdeconnect_SRC # modeltest.cpp ) -ecm_qt_declare_logging_category( - libkdeconnect_SRC - HEADER interfaces_debug.h - IDENTIFIER KDECONNECT_INTERFACES - CATEGORY_NAME kdeconnect.interfaces -) - geninterface(${CMAKE_SOURCE_DIR}/core/daemon.h daemoninterface) geninterface(${CMAKE_SOURCE_DIR}/core/device.h deviceinterface) geninterface(${CMAKE_SOURCE_DIR}/plugins/battery/batterydbusinterface.h devicebatteryinterface) diff --git a/interfaces/devicesmodel.cpp b/interfaces/devicesmodel.cpp index 07bc3f5a9..25f2bc495 100644 --- a/interfaces/devicesmodel.cpp +++ b/interfaces/devicesmodel.cpp @@ -33,6 +33,8 @@ #include // #include "modeltest.h" +Q_LOGGING_CATEGORY(KDECONNECT_INTERFACES, "kdeconnect.interfaces"); + static QString createId() { return QCoreApplication::instance()->applicationName()+QString::number(QCoreApplication::applicationPid()); } Q_GLOBAL_STATIC_WITH_ARGS(QString, s_keyId, (createId())); diff --git a/interfaces/interfaces_debug.h b/interfaces/interfaces_debug.h new file mode 100644 index 000000000..2cdb99e69 --- /dev/null +++ b/interfaces/interfaces_debug.h @@ -0,0 +1,28 @@ +/** + * Copyright 2014 Alejandro Fiestas Olivares + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef KDECONNECT_INTERFACE_DEBUG_H +#define KDECONNECT_INTERFACE_DEBUG_H + +#include + +Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_INTERFACES) + +#endif //KDECONNECT_INTERFACE_DEBUG_H