diff options
| author | Karel Klic <kklic@redhat.com> | 2010-01-20 18:51:28 +0100 |
|---|---|---|
| committer | Karel Klic <kklic@redhat.com> | 2010-01-20 18:51:28 +0100 |
| commit | bbb210c836aaa6487e643176548b8b3feb11c347 (patch) | |
| tree | 4a12b2a9672c639ddf9042a8d6bb06b14821d983 /src/CLI | |
| parent | d8ea20ec8a17f387ea75f4a19cadfbd33699d1d9 (diff) | |
| parent | 932c4d77abddb62ca4df1aca6d6c7d4e634a9e8d (diff) | |
| download | abrt-bbb210c836aaa6487e643176548b8b3feb11c347.tar.gz abrt-bbb210c836aaa6487e643176548b8b3feb11c347.tar.xz abrt-bbb210c836aaa6487e643176548b8b3feb11c347.zip | |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src/CLI')
| -rw-r--r-- | src/CLI/ABRTSocket.cpp | 6 | ||||
| -rw-r--r-- | src/CLI/ABRTSocket.h | 6 | ||||
| -rw-r--r-- | src/CLI/CLI.cpp | 6 | ||||
| -rw-r--r-- | src/CLI/dbus.cpp | 10 | ||||
| -rw-r--r-- | src/CLI/dbus.h | 6 | ||||
| -rw-r--r-- | src/CLI/report.cpp | 29 |
6 files changed, 32 insertions, 31 deletions
diff --git a/src/CLI/ABRTSocket.cpp b/src/CLI/ABRTSocket.cpp index 13531342..82c304ee 100644 --- a/src/CLI/ABRTSocket.cpp +++ b/src/CLI/ABRTSocket.cpp @@ -106,7 +106,7 @@ void CABRTSocket::Disconnect() close(m_nSocket); } -vector_crash_infos_t CABRTSocket::GetCrashInfos() +vector_map_crash_data_t CABRTSocket::GetCrashInfos() { std::string message = MESSAGE_GET_CRASH_INFOS; Send(message); @@ -115,7 +115,7 @@ vector_crash_infos_t CABRTSocket::GetCrashInfos() return string_to_crash_infos(message); } -map_crash_report_t CABRTSocket::CreateReport(const std::string &pUUID) +map_crash_data_t CABRTSocket::CreateReport(const std::string &pUUID) { std::string message = MESSAGE_CREATE_REPORT + pUUID; Send(message); @@ -124,7 +124,7 @@ map_crash_report_t CABRTSocket::CreateReport(const std::string &pUUID) return string_to_crash_report(message); } -void CABRTSocket::Report(const map_crash_report_t& pReport) +void CABRTSocket::Report(const map_crash_data_t& pReport) { std::string message = MESSAGE_REPORT + crash_report_to_string(pReport); Send(message); diff --git a/src/CLI/ABRTSocket.h b/src/CLI/ABRTSocket.h index c3a63e51..d4905be1 100644 --- a/src/CLI/ABRTSocket.h +++ b/src/CLI/ABRTSocket.h @@ -20,9 +20,9 @@ class CABRTSocket void Connect(const char *pPath); void Disconnect(); - vector_crash_infos_t GetCrashInfos(); - map_crash_report_t CreateReport(const char *pUUID); - void Report(const map_crash_report_t& pReport); + vector_map_crash_data_t GetCrashInfos(); + map_crash_data_t CreateReport(const char *pUUID); + void Report(const map_crash_data_t& pReport); int32_t DeleteDebugDump(const char *pUUID); }; diff --git a/src/CLI/CLI.cpp b/src/CLI/CLI.cpp index bc8ddf60..2f3b4048 100644 --- a/src/CLI/CLI.cpp +++ b/src/CLI/CLI.cpp @@ -47,12 +47,12 @@ enum OPT_DELETE }; -static void print_crash_infos(vector_crash_infos_t& pCrashInfos, int pMode) +static void print_crash_infos(vector_map_crash_data_t& pCrashInfos, int pMode) { unsigned int ii; for (ii = 0; ii < pCrashInfos.size(); ii++) { - map_crash_info_t& info = pCrashInfos[ii]; + map_crash_data_t& info = pCrashInfos[ii]; if (pMode == OPT_GET_LIST_FULL || info[CD_REPORTED][CD_CONTENT] != "1") { const char *timestr = info[CD_TIME][CD_CONTENT].c_str(); @@ -189,7 +189,7 @@ int main(int argc, char** argv) case OPT_GET_LIST: case OPT_GET_LIST_FULL: { - vector_crash_infos_t ci = call_GetCrashInfos(); + vector_map_crash_data_t ci = call_GetCrashInfos(); print_crash_infos(ci, op); break; } diff --git a/src/CLI/dbus.cpp b/src/CLI/dbus.cpp index 0d03c4d7..ffd1157e 100644 --- a/src/CLI/dbus.cpp +++ b/src/CLI/dbus.cpp @@ -104,7 +104,7 @@ static DBusMessage* send_get_reply_and_unref(DBusMessage* msg) } } -vector_crash_infos_t call_GetCrashInfos() +vector_map_crash_data_t call_GetCrashInfos() { DBusMessage* msg = new_call_msg(__func__ + 5); DBusMessage *reply = send_get_reply_and_unref(msg); @@ -112,7 +112,7 @@ vector_crash_infos_t call_GetCrashInfos() DBusMessageIter in_iter; dbus_message_iter_init(reply, &in_iter); - vector_crash_infos_t argout; + vector_map_crash_data_t argout; int r = load_val(&in_iter, argout); if (r != ABRT_DBUS_LAST_FIELD) /* more values present, or bad type */ error_msg_and_die("dbus call %s: return type mismatch", __func__ + 5); @@ -121,7 +121,7 @@ vector_crash_infos_t call_GetCrashInfos() return argout; } -map_crash_report_t call_CreateReport(const char* uuid) +map_crash_data_t call_CreateReport(const char* uuid) { DBusMessage* msg = new_call_msg(__func__ + 5); dbus_message_append_args(msg, @@ -133,7 +133,7 @@ map_crash_report_t call_CreateReport(const char* uuid) DBusMessageIter in_iter; dbus_message_iter_init(reply, &in_iter); - map_crash_report_t argout; + map_crash_data_t argout; int r = load_val(&in_iter, argout); if (r != ABRT_DBUS_LAST_FIELD) /* more values present, or bad type */ error_msg_and_die("dbus call %s: return type mismatch", __func__ + 5); @@ -142,7 +142,7 @@ map_crash_report_t call_CreateReport(const char* uuid) return argout; } -report_status_t call_Report(const map_crash_report_t& report) +report_status_t call_Report(const map_crash_data_t& report) { DBusMessage* msg = new_call_msg(__func__ + 5); DBusMessageIter out_iter; diff --git a/src/CLI/dbus.h b/src/CLI/dbus.h index c692e198..c6fd7a4d 100644 --- a/src/CLI/dbus.h +++ b/src/CLI/dbus.h @@ -23,9 +23,9 @@ extern DBusConnection* s_dbus_conn; -vector_crash_infos_t call_GetCrashInfos(); -map_crash_report_t call_CreateReport(const char *uuid); -report_status_t call_Report(const map_crash_report_t& report); +vector_map_crash_data_t call_GetCrashInfos(); +map_crash_data_t call_CreateReport(const char *uuid); +report_status_t call_Report(const map_crash_data_t& report); int32_t call_DeleteDebugDump(const char* uuid); #ifdef UNUSED diff --git a/src/CLI/report.cpp b/src/CLI/report.cpp index bc8f9008..11037ca7 100644 --- a/src/CLI/report.cpp +++ b/src/CLI/report.cpp @@ -19,7 +19,8 @@ #include "run-command.h" #include "dbus.h" #include "abrtlib.h" -#include "DebugDump.h" // FILENAME_* defines +#include "DebugDump.h" +#include "CrashTypes.h" // FILENAME_* defines #if HAVE_CONFIG_H # include <config.h> #endif @@ -151,10 +152,10 @@ static void remove_comments_and_unescape(char *str) * Writes a field of crash report to a file. * Field must be writable. */ -static void write_crash_report_field(FILE *fp, const map_crash_report_t &report, +static void write_crash_report_field(FILE *fp, const map_crash_data_t &report, const char *field, const char *description) { - const map_crash_report_t::const_iterator it = report.find(field); + const map_crash_data_t::const_iterator it = report.find(field); if (it == report.end()) { // exit silently, all fields are optional for now @@ -186,7 +187,7 @@ static void write_crash_report_field(FILE *fp, const map_crash_report_t &report, * If the report is successfully stored to the file, a zero value is returned. * On failure, nonzero value is returned. */ -static void write_crash_report(const map_crash_report_t &report, FILE *fp) +static void write_crash_report(const map_crash_data_t &report, FILE *fp) { fprintf(fp, "# Please check this report. Lines starting with '#' will be ignored.\n" "# Lines starting with '%%----' separate fields, please do not delete them.\n\n"); @@ -195,13 +196,13 @@ static void write_crash_report(const map_crash_report_t &report, FILE *fp) _("# Describe the circumstances of this crash below.")); write_crash_report_field(fp, report, CD_REPRODUCE, _("# How to reproduce the crash?")); - write_crash_report_field(fp, report, "backtrace", + write_crash_report_field(fp, report, FILENAME_BACKTRACE, _("# Stack trace: a list of active stack frames at the time the crash occurred\n# Check that it does not contain any sensitive data such as passwords.")); write_crash_report_field(fp, report, CD_UUID, _("# UUID")); write_crash_report_field(fp, report, FILENAME_ARCHITECTURE, _("# Architecture")); - write_crash_report_field(fp, report, "cmdline", _("# Command line")); + write_crash_report_field(fp, report, FILENAME_CMDLINE, _("# Command line")); write_crash_report_field(fp, report, FILENAME_COMPONENT, _("# Component")); - write_crash_report_field(fp, report, "coredump", _("# Core dump")); + write_crash_report_field(fp, report, FILENAME_COREDUMP, _("# Core dump")); write_crash_report_field(fp, report, FILENAME_EXECUTABLE, _("# Executable")); write_crash_report_field(fp, report, FILENAME_KERNEL, _("# Kernel version")); write_crash_report_field(fp, report, FILENAME_PACKAGE, _("# Package")); @@ -217,7 +218,7 @@ static void write_crash_report(const map_crash_report_t &report, FILE *fp) * 1 if the field was changed. * Changes to read-only fields are ignored. */ -static int read_crash_report_field(const char *text, map_crash_report_t &report, +static int read_crash_report_field(const char *text, map_crash_data_t &report, const char *field) { char separator[strlen("\n" FIELD_SEP) + strlen(field) + 2]; // 2 = '\n\0' @@ -234,7 +235,7 @@ static int read_crash_report_field(const char *text, map_crash_report_t &report, else length = end - textfield; - const map_crash_report_t::iterator it = report.find(field); + const map_crash_data_t::iterator it = report.find(field); if (it == report.end()) { error_msg("Field %s not found.\n", field); @@ -278,17 +279,17 @@ static int read_crash_report_field(const char *text, map_crash_report_t &report, * 1 if any field was changed. * Changes to read-only fields are ignored. */ -static int read_crash_report(map_crash_report_t &report, const char *text) +static int read_crash_report(map_crash_data_t &report, const char *text) { int result = 0; result |= read_crash_report_field(text, report, CD_COMMENT); result |= read_crash_report_field(text, report, CD_REPRODUCE); - result |= read_crash_report_field(text, report, "backtrace"); + result |= read_crash_report_field(text, report, FILENAME_BACKTRACE); result |= read_crash_report_field(text, report, CD_UUID); result |= read_crash_report_field(text, report, FILENAME_ARCHITECTURE); - result |= read_crash_report_field(text, report, "cmdline"); + result |= read_crash_report_field(text, report, FILENAME_CMDLINE); result |= read_crash_report_field(text, report, FILENAME_COMPONENT); - result |= read_crash_report_field(text, report, "coredump"); + result |= read_crash_report_field(text, report, FILENAME_COREDUMP); result |= read_crash_report_field(text, report, FILENAME_EXECUTABLE); result |= read_crash_report_field(text, report, FILENAME_KERNEL); result |= read_crash_report_field(text, report, FILENAME_PACKAGE); @@ -331,7 +332,7 @@ static int launch_editor(const char *path) int report(const char *uuid, bool always) { // Ask for an initial report. - map_crash_report_t cr = call_CreateReport(uuid); + map_crash_data_t cr = call_CreateReport(uuid); //TODO: error check? if (!always) |
