diff options
| author | Ilia K <ki.stfu@gmail.com> | 2015-03-19 17:17:26 +0000 |
|---|---|---|
| committer | Ilia K <ki.stfu@gmail.com> | 2015-03-19 17:17:26 +0000 |
| commit | 4c5a0b40def4bb0dede6bd8c8a5bbb477e4d173c (patch) | |
| tree | 0db4646b85cf0a6e67001264ab13c53bdbed73b8 /lldb/tools | |
| parent | 641f027d82b2973a081333e9f59cc027e732cedd (diff) | |
| download | bcm5719-llvm-4c5a0b40def4bb0dede6bd8c8a5bbb477e4d173c.tar.gz bcm5719-llvm-4c5a0b40def4bb0dede6bd8c8a5bbb477e4d173c.zip | |
Fix memory allocating inside signal handler (MI)
Summary:
This patch fixes a memory allocating inside signal handler.
This bug was found by @vharron:
> Hi all,
>
> I noticed these thread sanitizer warnings while running lldb-mi tests on
> Linux.
>
> WARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=39721)
>
> #0 operator new(unsigned long) <null>:0 (lldb-mi-3.7.0+0x000000092b9d)
>
> #1 std::string::_Rep::_S_create(unsigned long, unsigned long,
> std::allocator<char> const&) <null>:0 (libstdc++.so.6+0x0000000ba3b8)
>
> #2 CMICmnResources::GetStringFromResource(unsigned int, CMIUtilString&)
> const
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MICmnResources.cpp:434
> (lldb-mi-3.7.0+0x00000014ddd8)
>
> #3 CMICmnResources::GetString(unsigned int) const
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MICmnResources.cpp:371
> (lldb-mi-3.7.0+0x00000014db81)
>
> #4 sigwinch_handler(int)
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MIDriverMain.cpp:99
> (lldb-mi-3.7.0+0x0000001589ff)
>
> #5 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, int,
> my_siginfo_t*, void*) tsan_interceptors.o:0 (lldb-mi-3.7.0+0x00000009f25f)
>
> #6 void std::this_thread::sleep_for<long, std::ratio<1l, 1000l>
> >(std::chrono::duration<long, std::ratio<1l, 1000l> > const&)
> /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/thread:279
> (lldb-mi-3.7.0+0x00000013243e)
>
> #7 CMIDriver::ReadStdinLineQueue()
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MIDriver.cpp:710
> (lldb-mi-3.7.0+0x000000155e62)
>
> #8 CMIDriver::DoMainLoop()
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MIDriver.cpp:631
> (lldb-mi-3.7.0+0x000000155d37)
>
> #9 non-virtual thunk to CMIDriver::DoMainLoop()
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MIDriver.cpp:648
> (lldb-mi-3.7.0+0x000000155fbd)
>
> #10 CMIDriverMgr::DriverMainLoop()
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MIDriverMgr.cpp:340
> (lldb-mi-3.7.0+0x000000159ee6)
>
> #11 main
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MIDriverMain.cpp:364
> (lldb-mi-3.7.0+0x000000158f60)
Reviewers: vharron, abidh
Reviewed By: abidh
Subscribers: lldb-commits, abidh, vharron
Differential Revision: http://reviews.llvm.org/D8256
llvm-svn: 232735
Diffstat (limited to 'lldb/tools')
| -rw-r--r-- | lldb/tools/lldb-mi/MICmnResources.cpp | 1 | ||||
| -rw-r--r-- | lldb/tools/lldb-mi/MICmnResources.h | 2 | ||||
| -rw-r--r-- | lldb/tools/lldb-mi/MIDriverMain.cpp | 3 |
3 files changed, 0 insertions, 6 deletions
diff --git a/lldb/tools/lldb-mi/MICmnResources.cpp b/lldb/tools/lldb-mi/MICmnResources.cpp index 64d73ee7238..4e27b43900e 100644 --- a/lldb/tools/lldb-mi/MICmnResources.cpp +++ b/lldb/tools/lldb-mi/MICmnResources.cpp @@ -86,7 +86,6 @@ const CMICmnResources::SRsrcTextData CMICmnResources::ms_pResourceId2TextData[] {IDS_CMDFACTORY_ERR_CMD_ALREADY_REGED, "Command factory. Command '%s' by that name already registered"}, {IDS_CMDMGR_ERR_CMD_FAILED_CREATE, "Command manager. Command creation failed. %s"}, {IDS_CMDMGR_ERR_CMD_INVOKER, "Command manager. %s "}, - {IDS_PROCESS_SIGNAL_RECEIVED, "Process signal. Application received signal '%s' (%d)"}, {IDS_MI_INIT_ERR_LOG, "Log. Error occurred during initialisation %s"}, {IDS_MI_INIT_ERR_RESOURCES, "Resources. Error occurred during initialisation %s"}, {IDS_MI_INIT_ERR_INIT, "Driver. Error occurred during initialisation %s"}, diff --git a/lldb/tools/lldb-mi/MICmnResources.h b/lldb/tools/lldb-mi/MICmnResources.h index cdcb29da9ec..ffaa23cb11d 100644 --- a/lldb/tools/lldb-mi/MICmnResources.h +++ b/lldb/tools/lldb-mi/MICmnResources.h @@ -104,8 +104,6 @@ enum IDS_CMDMGR_ERR_CMD_FAILED_CREATE, IDS_CMDMGR_ERR_CMD_INVOKER, - IDS_PROCESS_SIGNAL_RECEIVED, - IDS_MI_INIT_ERR_LOG, IDS_MI_INIT_ERR_RESOURCES, IDS_MI_INIT_ERR_INIT, diff --git a/lldb/tools/lldb-mi/MIDriverMain.cpp b/lldb/tools/lldb-mi/MIDriverMain.cpp index 8b4d901905d..542472c247b 100644 --- a/lldb/tools/lldb-mi/MIDriverMain.cpp +++ b/lldb/tools/lldb-mi/MIDriverMain.cpp @@ -39,7 +39,6 @@ #include "MICmnResources.h" #include "MICmnStreamStdin.h" #include "MIUtilDebug.h" -#include "MICmnLog.h" #if defined(_MSC_VER) @@ -77,8 +76,6 @@ sigint_handler(int vSigno) } } - CMICmnLog::Instance().WriteLog(CMIUtilString::Format(MIRSRC(IDS_PROCESS_SIGNAL_RECEIVED), "SIGINT", vSigno)); - // Send signal to driver so that it can take suitable action rDriverMgr.DeliverSignal (vSigno); } |

