It works! Push it

On Wednesday 29 of August 2012 19:53:08 Richard Marko wrote:
> In case when package debuginfo is present, gdb will output only
> function names but no offsets preventing core backtrace generation.
> 
> Setting non-existent debuginfo directory resolves this.
> ---
>  src/lib/hooklib.c                                 | 29
> +++++++++++++++-------- src/plugins/abrt-action-generate-core-backtrace.c |
>  2 +-
>  2 files changed, 20 insertions(+), 11 deletions(-)
> 
> diff --git a/src/lib/hooklib.c b/src/lib/hooklib.c
> index 1b30a5b..ca799e0 100644
> --- a/src/lib/hooklib.c
> +++ b/src/lib/hooklib.c
> @@ -249,17 +249,26 @@ char *get_backtrace(const char *dump_dir_name,
> unsigned timeout_sec, const char //
> (https://bugzilla.redhat.com/show_bug.cgi?id=528668):
>      args[2] = (char*)"-ex";
>      struct strbuf *set_debug_file_directory = strbuf_new();
> -    strbuf_append_str(set_debug_file_directory, "set debug-file-directory
> /usr/lib/debug"); -    const char *p = debuginfo_dirs;
> -    while (1)
> +    if(debuginfo_dirs == NULL)
>      {
> -        while (*p == ':')
> -            p++;
> -        if (*p == '\0')
> -            break;
> -        const char *colon_or_nul = strchrnul(p, ':');
> -        strbuf_append_strf(set_debug_file_directory, ":%.*s/usr/lib/debug",
> (int)(colon_or_nul - p), p); -        p = colon_or_nul;
> +        // set non-existent debug file directory to prevent resolving
> +        // function names - we need offsets for core backtrace.
> +        strbuf_append_str(set_debug_file_directory, "set
> debug-file-directory /"); +    }
> +    else
> +    {
> +        strbuf_append_str(set_debug_file_directory, "set
> debug-file-directory /usr/lib/debug"); +        const char *p =
> debuginfo_dirs;
> +        while (1)
> +        {
> +            while (*p == ':')
> +                p++;
> +            if (*p == '\0')
> +                break;
> +            const char *colon_or_nul = strchrnul(p, ':');
> +            strbuf_append_strf(set_debug_file_directory,
> ":%.*s/usr/lib/debug", (int)(colon_or_nul - p), p); +            p =
> colon_or_nul;
> +        }
>      }
>      args[3] = strbuf_free_nobuf(set_debug_file_directory);
> 
> diff --git a/src/plugins/abrt-action-generate-core-backtrace.c
> b/src/plugins/abrt-action-generate-core-backtrace.c index 5fccb89..9bd09a4
> 100644
> --- a/src/plugins/abrt-action-generate-core-backtrace.c
> +++ b/src/plugins/abrt-action-generate-core-backtrace.c
> @@ -106,7 +106,7 @@ int main(int argc, char **argv)
>      if (strcmp(analyzer, "CCpp") == 0)
>      {
>          VERB1 log("Querying gdb for backtrace");
> -        char *gdb_out = get_backtrace(dump_dir_name, exec_timeout_sec, "");
> +        char *gdb_out = get_backtrace(dump_dir_name, exec_timeout_sec,
> NULL); if (gdb_out == NULL)
>              xfunc_die();

Reply via email to