summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-04-01 14:37:00 +0200
committerZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-04-01 14:37:00 +0200
commitfd65c793997f3fcc1ee01ad4b0991afee1cc4d19 (patch)
tree3ebe5b3b95c4a7d16e97c8c00feb3e3590a711e3 /lib
parent2d1c2342637bb6d761cb115ac97c4a7bc51141ab (diff)
added killing of debuginfo-install if CCpp is unloaded
Diffstat (limited to 'lib')
-rw-r--r--lib/Plugins/CCpp.cpp21
-rw-r--r--lib/Plugins/CCpp.h3
2 files changed, 21 insertions, 3 deletions
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index e0f3714..38f1a2a 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -38,11 +38,23 @@
#define CORE_PATTERN "|"CCPP_HOOK_PATH" %p %s %u"
CAnalyzerCCpp::CAnalyzerCCpp() :
- m_bMemoryMap(false)
+ m_bMemoryMap(false),
+ m_Pid(0)
{}
+CAnalyzerCCpp::~CAnalyzerCCpp()
+{
+ if (m_Pid)
+ {
+ kill(m_Pid, SIGTERM);
+ wait(NULL);
+ }
+}
+
void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage)
{
+ std::string packageName = pPackage.substr(0, pPackage.rfind("-", pPackage.rfind("-")-1));
+ std::cerr << packageName << std::endl;
char buff[1024];
int pipein[2], pipeout[2];
struct timeval delay;
@@ -56,6 +68,7 @@ void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage)
fcntl(pipeout[1], F_SETFD, FD_CLOEXEC);
child = fork();
+ m_Pid = child;
if (child < 0)
{
throw std::string("CAnalyzerCCpp::RunGdb(): fork failed.");
@@ -103,7 +116,8 @@ void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage)
{
buff[r] = '\0';
std::cerr << buff;
- if (strstr(buff, "already installed and latest version") != NULL)
+ if (strstr(buff, packageName.c_str()) != NULL &&
+ strstr(buff, "already installed and latest version") != NULL)
{
break;
}
@@ -137,6 +151,7 @@ void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage)
close(pipeout[0]);
wait(NULL);
+ m_Pid = 0;
}
void CAnalyzerCCpp::GetBacktrace(const std::string& pDebugDumpDir, std::string& pBacktrace)
@@ -222,6 +237,7 @@ void CAnalyzerCCpp::RunGdb(const std::string& pScript, const std::string pUID, s
fcntl(pipeout[1], F_SETFD, FD_CLOEXEC);
child = fork();
+ m_Pid = child;
if (child == -1)
{
throw std::string("CAnalyzerCCpp::RunGdb(): fork failed.");
@@ -274,6 +290,7 @@ void CAnalyzerCCpp::RunGdb(const std::string& pScript, const std::string pUID, s
}
close(pipeout[0]);
wait(NULL);
+ m_Pid = 0;
}
std::string CAnalyzerCCpp::GetLocalUUID(const std::string& pDebugDumpDir)
diff --git a/lib/Plugins/CCpp.h b/lib/Plugins/CCpp.h
index 9a94659..41a4d5b 100644
--- a/lib/Plugins/CCpp.h
+++ b/lib/Plugins/CCpp.h
@@ -31,6 +31,7 @@ class CAnalyzerCCpp : public CAnalyzer
{
private:
bool m_bMemoryMap;
+ pid_t m_Pid;
std::string m_sOldCorePattern;
void InstallDebugInfos(const std::string& pPackage);
void GetBacktrace(const std::string& pDebugDumpDir, std::string& pBacktrace);
@@ -39,7 +40,7 @@ class CAnalyzerCCpp : public CAnalyzer
public:
CAnalyzerCCpp();
- virtual ~CAnalyzerCCpp() {}
+ virtual ~CAnalyzerCCpp();
std::string GetLocalUUID(const std::string& pDebugDumpDir);
std::string GetGlobalUUID(const std::string& pDebugDumpDir);
void CreateReport(const std::string& pDebugDumpDir);