summaryrefslogtreecommitdiffstats
path: root/lib/Plugins/CCpp.cpp
Commit message (Collapse)AuthorAgeFilesLines
* lib/Plugins/CCpp.cpp: log polkit_check_authorization failuresDenys Vlasenko2009-10-151-23/+17
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* better logging of execv parametersDenys Vlasenko2009-10-151-5/+13
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lib/Plugins/CCpp.cpp: fixing a wrong applied patch...Denys Vlasenko2009-10-131-8/+11
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lib/Plugins/CCpp.cpp: add build-ids to backtraceDenys Vlasenko2009-10-131-5/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lib/Plugins/CCpp.cpp: do not use temp file for gdb commands - use -ex CMD ↵Denys Vlasenko2009-10-131-24/+27
| | | | | | instead Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* CCpp analyser: log executing of children; comment about pk-debuginfo-istallDenys Vlasenko2009-10-091-1/+34
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* removed JobStarted signal; fixed a small bug in build-id scanning codeDenys Vlasenko2009-10-091-1/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: add "force" param to CreateReport dbus call. If !0, regenerates backtraceDenys Vlasenko2009-10-091-8/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Jan Kratochvil's fix (#525721): use core _only_, not executable image for ↵Denys Vlasenko2009-10-061-4/+9
| | | | | | backtrace Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* try using pk-debuginfo-install before falling back to debuginfo-installDenys Vlasenko2009-09-301-1/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* remove DBusManager::uniq_nameDenys Vlasenko2009-09-291-1/+1
| | | | | | also fix some whitespace damage Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* add support for abrtd autostartDenys Vlasenko2009-09-291-27/+52
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* remove a few #include <iostream>'sDenys Vlasenko2009-09-181-7/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* new polkit action for installing debuginfo, default "yes"dnovotny2009-09-161-1/+1
|
* fixed closing of debug dump in case of existing backtraceZdenek Prikryl2009-09-171-1/+2
|
* backtrace declared twicednovotny2009-09-161-1/+0
|
* merge correctiondnovotny2009-09-161-6/+3
|
* Merge branch 'master' of git://git.fedorahosted.org/git/abrtdnovotny2009-09-161-174/+227
|\ | | | | | | | | | | Conflicts: lib/Plugins/CCpp.cpp lib/Utils/Polkit.cpp
| * small correction to previous commit (forgot .debug suffix)Denys Vlasenko2009-09-151-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * initial code for better debuginfo installation.Denys Vlasenko2009-09-151-178/+221
| | | | | | | | | | | | | | For now, it skips debuginfo install step if all build-ids retrieved from coredump appear to already exist Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | added timeout to Polkit, added authorization check for debuginfo-installdnovotny2009-09-161-1/+39
|/
* fix the bug where lock file was not removedDenys Vlasenko2009-09-091-3/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* preparatory work for proper (i.e. unicast) server->client dbus communicationDenys Vlasenko2009-09-071-13/+18
| | | | | | | | + /* send unicast dbus signal */ + if (!dbus_message_set_destination(msg, pDest)) + die_out_of_memory(); Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Add new config option InstallDebuginfo into CCpp.confNikola Pajkovsky2009-09-071-2/+16
|
* add gettext support for all pluginsNikola Pajkovsky2009-09-021-6/+6
|
* consolidate container typedefs in one file (we had a few dupes)Denys Vlasenko2009-08-271-1/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* eliminate global variable g_cwDenys Vlasenko2009-08-271-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* add job ids (== thread ids) to warning/update DBus messagesDenys Vlasenko2009-08-261-7/+8
| | | | | | | | renamed: comm_layer_inner_warning -> warn_client comm_layer_inner_status -> update_client Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* more sensible loggingDenys Vlasenko2009-08-251-1/+1
| | | | | | | | | | | comm_layer_inner_debug was jumping through the hoops in order to simply send a message to stderr. this can be made much simpler. also, set logmode to LOGMODE_SYSLOG in abrt daemon, making its log visible if it is daemonized. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Plugins/CCpp: remove trailing \n from debuginfo-install's outputDenys Vlasenko2009-08-191-0/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* CCpp plugin: do not abort if debuginfos aren't foundDenys Vlasenko2009-08-191-14/+23
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* simplify parsing of debuginfo-install outputDenys Vlasenko2009-08-181-49/+26
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* make ccpp plugin more verboseZdenek Prikryl2009-08-141-0/+1
|
* moved LoadSettings from plugins into PluginManagerZdenek Prikryl2009-08-111-8/+0
|
* fix compile-time warnings.Denys Vlasenko2009-08-091-7/+5
| | | | | | | One fix (in CCrashWatcher::GetPluginsInfo) needs closer look, others are "trivially correct" Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Split real code from lib/MiddleWare/Plugin.h into Plugin.cpp.Denys Vlasenko2009-08-071-10/+1
| | | | | | 30k smaller code. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fix a case when we print a warning twice.Denys Vlasenko2009-08-061-13/+14
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Minor fixes - just to make sources compile.Jiri Moskovcak2009-08-041-4/+4
|
* lib/Plugins/CCpp.cpp: move functions out of class where appropriate.Denys Vlasenko2009-08-031-25/+16
| | | | | | | | | | | | | | | | | | | I was struggling to read the code where classes have member functions with no apparent reasons to be such: they do not use any members of the class. Having them members of the class have only disadvantages: they need to be declared in the class (thus you need to touch TWO files), they cannot be shared among different classes, they look confusing at callsites - the code falsely suggests that function uses or alters object's state, they also are a bit less efficient. I was hesitating to do so before, but now I was told that there is a plan to gradually move to C implementation... then this change makes it a bit closer to that. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* added new interface for geting plugins' settings (will be used in gui)Zdenek Prikryl2009-07-311-4/+23
|
* Move PLUGIN_INFOs to .cpp files: same object must never be defined twiceDenys Vlasenko2009-07-311-0/+9
| | | | | | | | and if structure is defined in a .h file, that happens. Since this particular structure has non-trivial destructor, it was running twice and resulted in double-free. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* add utility functionsDenys Vlasenko2009-07-301-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Logging machinery provided by this patch consists of several functions: +extern void error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); +extern void error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); +extern void perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); +extern void perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); +/* This is a macro since it collides with log() from math.h */ +#undef log +#define log(...) error_msg(__VA_ARGS__) They are taking printf-style format strings. perror_msg_xxx functions append an errno string after the message: "xxx xxx xxx: No such file or directory" if errno is != 0. xxx_and_die functions do not return. All functions also ensure that the message ends with "\n", meaning that you do not need to add it into the message, but if you do, an extra "\n" will not be added. All functions ensure that the string is written in a single write() call, thus if two processes output to the same terminal or file, messages don't get intermingled. Ordinarily, messages go to the stderr. By setting global variable "logmode" to LOGMODE_SYSLOG or LOGMODE_NONE, they can be sent to syslog or be suppressed. Standard setting is LOGMODE_STDIO. LOGMODE_STDIO + LOGMODE_SYSLOG works too. Usually it is set by main() as needed, and then you can fearlessly use [p]error_msg[_and_die]() and be sure that message goes to the right place. +enum { + LOGMODE_NONE = 0, + LOGMODE_STDIO = (1 << 0), + LOGMODE_SYSLOG = (1 << 1), + LOGMODE_BOTH = LOGMODE_SYSLOG + LOGMODE_STDIO, +}; +extern int logmode; Exit code of xxx_and_die variants is controlled by the global variable +extern int xfunc_error_retval; By default it is = 1. Logging infrastructure uses a few other functions, which I find useful on their own, and since I discussed them with Zdenek and he thinks that they may be useful too, they are included in the patch also. The first group is "malloc or die" group: +void* malloc_or_warn(size_t size); +void* xmalloc(size_t size); +void* xrealloc(void *ptr, size_t size); +void* xzalloc(size_t size); +char* xstrdup(const char *s); +char* xstrndup(const char *s, int n); They are basically versions of malloc etc which exit on failure. The next group are simple I/O wrappers: +extern ssize_t safe_read(int fd, void *buf, size_t count); +extern ssize_t full_read(int fd, void *buf, size_t count); +extern void xread(int fd, void *buf, size_t count); +extern ssize_t safe_write(int fd, const void *buf, size_t count); +extern ssize_t full_write(int fd, const void *buf, size_t count); safe_xxx deal with the fact that read and write operations may "fail" with EINTR and in many cases we want to just repeat the operation. full_xxx deal with the fact that read and write are not guaranteed to read or write exact amount, they may to transfer less bytes. In this case we need to loop. The next group are the "x functions": +extern void xwrite(int fd, const void *buf, size_t count); +extern void xwrite_str(int fd, const char *str); +void xpipe(int filedes[2]); +void xdup2(int from, int to); +off_t xlseek(int fd, off_t offset, int whence); +void xsetenv(const char *key, const char *value); +int xsocket(int domain, int type, int protocol); +void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); +void xlisten(int s, int backlog); +ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, socklen_t tolen); +void xstat(const char *name, struct stat *stat_buf); +void xmove_fd(int from, int to); +char* xasprintf(const char *format, ...); They are similar to xmalloc in a sense that they exit on the failure. Most of them closely resemble corresponding libc functions. xmove_fd() is a wrapper for typical idiom "if (fd1!=fd2) dup2(fd1,fd2)", with error checking on dup2 failure added. xasprintf() is a "strcat on steroids". It's a printf-like function which returns a malloced string. In my experience, it is surprisingly useful: it makes complex concatenations easy in C. All these functions are declared in a new header, inc/abrtlib.h. It also contains a list of #includes: +#include <ctype.h> +#include <dirent.h> +#include <errno.h> +#include <fcntl.h> +#include <inttypes.h> +#include <setjmp.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <stddef.h> +#include <string.h> +#include <sys/poll.h> +#include <sys/mman.h> +#include <sys/socket.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <termios.h> +#include <time.h> +#include <unistd.h> +/* Try to pull in PATH_MAX */ +#include <limits.h> +#include <sys/param.h> +#ifndef PATH_MAX +# define PATH_MAX 256 +#endif +#include <pwd.h> +#include <grp.h> The rationale to do so is that these headers are pretty standard, and by having them included in this one file, we won't need to add #includes into many .c[pp] files later. The slowdown from gcc parsing these headers even if they are not needed is not worth spending time on optimizing out. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* two trivial fixlets in lib/Plugins/CCpp.cppDenys Vlasenko2009-07-291-4/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Be more paranoid about /proc/.../core_patternDenys Vlasenko2009-07-251-0/+17
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Merge branch 'master' of git://git.fedorahosted.org/abrtZdenek Prikryl2009-07-241-31/+22
|\
| * remove superfluous copying in ExecVP paramsDenys Vlasenko2009-07-241-3/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * remove GetGIDFromUID (two copies): getpwuid does the sameDenys Vlasenko2009-07-241-23/+8
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * simplify CAnalyzerCCpp::CreateHashDenys Vlasenko2009-07-241-5/+12
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | simple fixZdenek Prikryl2009-07-241-1/+1
|/
* style fix by popular (Zdenek's) demandDenys Vlasenko2009-07-231-6/+3
| | | | | | | | | | | | | | | Zdenek said: Ahother thing: commit "CCpp.cpp: fix handling of pipes when we fork children". You added piece code with while(1) and then there is a break inside the loop. Personally, I don't like infinite loops :-). There can be something like: ... int r; while ((r = read(pipeout[0], buff, sizeof(buff) - 1) > 0) { Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>