BuildRequires: dotnet-build-tools
BuildRequires: unzip
BuildRequires: corefx-managed
+BuildRequires: libdlog-devel
Requires: coreclr
# .NET Core Runtime
target_link_libraries(netcoredbg corguids dl pthread)
endif()
+if (CLR_CMAKE_TARGET_TIZEN_LINUX)
+ add_definitions(-DDEBUGGER_FOR_TIZEN)
+ target_link_libraries(netcoredbg dlog)
+endif (CLR_CMAKE_TARGET_TIZEN_LINUX)
+
install(TARGETS netcoredbg DESTINATION ${CMAKE_INSTALL_PREFIX})
if (DBGSHIM_LOCATION)
install(FILES ${DBGSHIM_LOCATION} DESTINATION ${CMAKE_INSTALL_PREFIX})
#include <chrono>
#include "logger.h"
+#ifdef DEBUGGER_FOR_TIZEN
+#include "dlog/dlog.h"
+
+
+class DlogLogger : public LoggerImpl
+{
+ const std::string tag = "NETCOREDBG";
+
+ public:
+ DlogLogger() {}
+ ~DlogLogger() override {}
+ void log(LogLevel level, const std::string& msg) override;
+};
+
+void DlogLogger::log(LogLevel level, const std::string& msg)
+{
+ // Use LOG_DEBUG wisely!
+ if (level == LOG_DEBUG)
+ dlog_print(DLOG_DEBUG, tag.c_str(), "%s", msg.c_str());
+ else if (level == LOG_INFO)
+ dlog_print(DLOG_INFO, tag.c_str(), "%s", msg.c_str());
+ else if (level == LOG_WARN)
+ dlog_print(DLOG_WARN, tag.c_str(), "%s", msg.c_str());
+ else if (level == LOG_ERROR)
+ dlog_print(DLOG_ERROR, tag.c_str(), "%s", msg.c_str());
+}
+#endif
case FILE_LOG:
logger = std::make_shared<FileLogger>(level);
break;
+ case DLOG_LOG:
+#ifdef DEBUGGER_FOR_TIZEN
+ logger = std::make_shared<DlogLogger>();
+ break;
+#endif
case NO_LOG:
default:
logger = std::make_shared<NoLogger>();
enum LogType {
NO_LOG = 0,
FILE_LOG,
+ DLOG_LOG,
};
enum LogLevel {
LOG_DEBUG = 0,
LOG_INFO,
+ LOG_WARN,
+ LOG_ERROR,
};
"--server[=port_num] Start the debugger listening for requests on the\n"
" specified TCP/IP port instead of stdin/out. If port is not specified\n"
" TCP %i will be used.\n"
+ #ifdef DEBUGGER_FOR_TIZEN
+ "--log[=<debug>] Enable logging to dlog. Supported\n"
+ " two log levels: info and debug. Info contains info, warn and error\n"
+ " messages, debug the same and debug messages in addition. Info level\n"
+ " is the default one. Overwrites other log types\n"
+ #endif
"--log-file[=<debug>] Enable logging to file which is created in 'current'. Supported\n"
" two log levels: info and debug. Info contains info, warn and error\n"
" messages, debug the same and debug messages in addition. Info level\n"
- " is the default one.\n",
+ " is the default one. Overwrites other log types\n",
(int)DEFAULT_SERVER_PORT
);
}
print_help();
return EXIT_SUCCESS;
}
+#ifdef DEBUGGER_FOR_TIZEN
+ else if (strcmp(argv[i], "--log") == 0)
+ {
+ logType = DLOG_LOG;
+ }
+ else if (strstr(argv[i], "--log=") == argv[i])
+ {
+ const std::string &debug = "debug";
+
+ logType = DLOG_LOG;
+ if (std::string(argv[i] + strlen("--log=")) == debug)
+ logLevel = LOG_DEBUG;
+ else
+ logLevel = LOG_INFO;
+ }
+#endif
else if (strcmp(argv[i], "--log-file") == 0)
{
logType = FILE_LOG;
}
Logger::setLogging(logType, logLevel);
- Logger::log("Start logging to file");
+ Logger::log("Start logging. Level %d", logLevel);
ManagedDebugger debugger;
std::unique_ptr<Protocol> protocol;