From: Serge Petrenko <sergepetrenko@tarantool.org> To: Cyrill Gorcunov <gorcunov@gmail.com>, tml <tarantool-patches@dev.tarantool.org> Cc: Mons Anderson <v.perepelitsa@corp.mail.ru>, Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v4 3/4] crash: move fatal signal handling in Date: Fri, 11 Dec 2020 12:31:18 +0300 [thread overview] Message-ID: <f73f257f-b87f-bc88-d2e8-3028d13866ae@tarantool.org> (raw) In-Reply-To: <20201210161832.729439-4-gorcunov@gmail.com> 10.12.2020 19:18, Cyrill Gorcunov пишет: > When SIGSEGV or SIGFPE reaches the tarantool we try to gather > all information related to the crash and print it out to the > console (well, stderr actually). Still there is a request > to not just show this info locally but send it out to the > feedback server. > > Thus to keep gathering crash related information in one module, > we move fatal signal handling into the separate crash.c file. > This allows us to collect the data we need in one place and > reuse it when we need to send reports to stderr (and to the > feedback server, which will be implemented in next patch). > > Part-of #5261 > > Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Thanks for the patch! Please find a couple of style comments below. Other than that the patch looks good. > --- > src/lib/core/CMakeLists.txt | 1 + > src/lib/core/crash.c | 291 ++++++++++++++++++++++++++++++++++++ > src/lib/core/crash.h | 32 ++++ > src/main.cc | 138 +---------------- > 4 files changed, 329 insertions(+), 133 deletions(-) > create mode 100644 src/lib/core/crash.c > create mode 100644 src/lib/core/crash.h > > diff --git a/src/lib/core/CMakeLists.txt b/src/lib/core/CMakeLists.txt > index 13ed1e7ab..06b2b91e1 100644 > --- a/src/lib/core/CMakeLists.txt > +++ b/src/lib/core/CMakeLists.txt > @@ -1,5 +1,6 @@ > set(core_sources > diag.c > + crash.c > say.c > memory.c > clock.c > diff --git a/src/lib/core/crash.c b/src/lib/core/crash.c > new file mode 100644 > index 000000000..9572a023c > --- /dev/null > +++ b/src/lib/core/crash.c > @@ -0,0 +1,291 @@ > +/* > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright 2010-2020, Tarantool AUTHORS, please see AUTHORS file. I haven't seen us using such a license before. It must be fine, I'm just not familiar with this. > + */ > + > +#include <string.h> > +#include <unistd.h> > +#include <time.h> > + > +/** > + * Report crash information to the stderr > + * (usually a current console). > + */ > +static void > +crash_report_stderr(struct crash_info *cinfo) > +{ > + if (cinfo->signo == SIGSEGV) { > + fprintf(stderr, "Segmentation fault\n"); > + const char *signal_code_repr = 0; Please use NULL for pointers. > + > + switch (cinfo->sicode) { > + case SEGV_MAPERR: > + signal_code_repr = "SEGV_MAPERR"; > + break; > + case SEGV_ACCERR: > + signal_code_repr = "SEGV_ACCERR"; > + break; > + } > + > + if (signal_code_repr) Please add `!= NULL` to the condition. -- Serge Petrenko
next prev parent reply other threads:[~2020-12-11 9:31 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-10 16:18 [Tarantool-patches] [PATCH v4 0/4] crash: implement sending feedback Cyrill Gorcunov 2020-12-10 16:18 ` [Tarantool-patches] [PATCH v4 1/4] util: introduce strlcpy helper Cyrill Gorcunov 2020-12-11 7:34 ` Serge Petrenko 2020-12-11 7:58 ` Serge Petrenko 2020-12-11 10:04 ` Cyrill Gorcunov 2020-12-11 11:07 ` Serge Petrenko 2020-12-11 11:38 ` Cyrill Gorcunov 2020-12-14 22:54 ` Vladislav Shpilevoy 2020-12-14 22:54 ` Vladislav Shpilevoy 2020-12-15 8:47 ` Cyrill Gorcunov 2020-12-10 16:18 ` [Tarantool-patches] [PATCH v4 2/4] backtrace: allow to specify destination buffer Cyrill Gorcunov 2020-12-11 7:50 ` Serge Petrenko 2020-12-10 16:18 ` [Tarantool-patches] [PATCH v4 3/4] crash: move fatal signal handling in Cyrill Gorcunov 2020-12-11 9:31 ` Serge Petrenko [this message] 2020-12-11 10:38 ` Cyrill Gorcunov 2020-12-11 11:12 ` Serge Petrenko 2020-12-14 22:54 ` Vladislav Shpilevoy 2020-12-15 8:16 ` Cyrill Gorcunov 2020-12-20 14:48 ` Vladislav Shpilevoy 2020-12-20 15:49 ` Cyrill Gorcunov 2020-12-20 16:07 ` Vladislav Shpilevoy 2020-12-20 16:58 ` Cyrill Gorcunov 2020-12-20 15:45 ` Vladislav Shpilevoy 2020-12-10 16:18 ` [Tarantool-patches] [PATCH v4 4/4] crash: report crash data to the feedback server Cyrill Gorcunov 2020-12-11 12:57 ` Serge Petrenko 2020-12-12 16:19 ` Cyrill Gorcunov 2020-12-12 17:07 ` Cyrill Gorcunov 2020-12-14 9:41 ` Serge Petrenko 2020-12-14 22:54 ` Vladislav Shpilevoy 2020-12-16 11:16 ` Cyrill Gorcunov 2020-12-16 20:31 ` Cyrill Gorcunov 2020-12-20 15:16 ` Vladislav Shpilevoy 2020-12-20 18:26 ` Cyrill Gorcunov 2020-12-20 14:48 ` Vladislav Shpilevoy 2020-12-20 18:21 ` Cyrill Gorcunov 2020-12-20 18:41 ` Vladislav Shpilevoy 2020-12-20 19:16 ` Cyrill Gorcunov 2020-12-21 17:01 ` Vladislav Shpilevoy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=f73f257f-b87f-bc88-d2e8-3028d13866ae@tarantool.org \ --to=sergepetrenko@tarantool.org \ --cc=gorcunov@gmail.com \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.perepelitsa@corp.mail.ru \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v4 3/4] crash: move fatal signal handling in' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox