C/C++ :: Send Signal SEGV To Crash A Running Process In Windows To Dump Core
Jul 2, 2014
I need to do an equivalent of kill -11 <pid>(which is in unix) in windows.
I need to crash a process with SEGV so that it would dump core in windows. Is there any tool by which we can do this . Also is there any sample code through which we can achieve this .
In windows we have taskill which only terminates a process , but is unable to send a signal like SEGV to the process upon which it would terminate and dump core .
View 9 Replies
ADVERTISEMENT
Oct 15, 2014
I got the core dump file so I know exactly which line it crashes. Below are some of the information:
OS: Red Hat Enterprise 5.8
Example snippets of when the crash happen:
Code:
typedef map<int, MyClassObj> MyMapT;
.
.
void someFunction( MyMapT& inMap )
{
for ( MyMapT::iterator iter=inMap.begin(); iter!=inMap.end(); ++iter )
{
.
.
}
}
Using GDB, I am able to find out that it crashes at the "++iter" as the .h file indicate it was a "++" operation for the iterator. Tracing up the stack frame it indicate it crash during the copy constructor of some "__rb_tree_node". I did some Googling and it seems that is some Red-Black tree implementation for the map. Honestly I do not quite understand the Red-Black tree and I believe STL map is a very very well tested container, so the problem must lie in my code so that I can look out for it.
View 14 Replies
View Related
May 19, 2013
I'va got a segmentation problem with creation of core dump for the following snippet of c code:
Code:
#include
#include
#include
"lezione.h" studente s1, s2; studenti s;
int main()
{ int codice; char* nome; char* cognome; int esami;
printf("Leggi uno studente da tastiera e memorizzalo in una struct
");
lettura_studente(s1, codice, nome, cognome, esami); return 0;
}
[code]....
In conclusion I'va two problems:
1) Program crash;
2) I can't read struct studente within parameter function. What are the problems?
View 4 Replies
View Related
Apr 9, 2014
I'm writing a code using least mean square to fit a sample of data. The code is running till an iteration where it crashes and returns a segmentation fault core dumped
(the memory used is always closed to 2g mem=1805804kb,vmem=1926132kb, seems like the code can't go beyond) .
But If i try to fit at this last iteration the code works perfectly, so i think that I'm not trying to access a variable at a wrong index but it might be dynamic memory allocation ( a pointer to a matrix that I didn't free or something like that). The code is complex and calls too many routines, I'm combining cimg , c++ and old c. How can I track this error?
View 19 Replies
View Related
Feb 3, 2014
I am trying to create a program that would execute a foreground process. I have this code for the foreground process
Code:
#include <stdio.h>
#include <signal.h>
int main() {
int temp;
printf("We are in the current program
[Code] ....
And this is my main program
Code:
#include <unistd.h>
#include <signal.h>
#include <stdio.h>
int main() {
signal(SIGINT, SIG_IGN);
[Code] ....
My main program stops executing after the process "./scanf" executes and there fore does not print the line "How are You"...
I want to main program to continue executing after "./scanf" finishes. How to achieve that?
View 2 Replies
View Related
Dec 13, 2013
I have a class which dynamically allocates memory for three data arrays, and as such in the destructor I told it to delete those data arrays.
However, when I've created a new class, and inherited the previous class - it will always crash AFTER running the program, unless I don't have the previous destructor present.
View 3 Replies
View Related
Oct 18, 2014
I'm strugling to understand why my app is crashing if there is no internet connection.
Code:
int main() {
WSADATA wsaData;
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
std::cout << "WSAStartup failed.
[Code] ....
Debug crash code:
Code:
First-chance exception at 0x00161831 in ConsoleApplication1.exe: 0xC0000005: Access violation reading location 0x0000000C.
Unhandled exception at 0x00161831 in ConsoleApplication1.exe: 0xC0000005: Access violation reading location 0x0000000C.
It works well as long as the computer is connected to internet but if i disconect from internet the application crash but don't understand why.
View 4 Replies
View Related
Dec 21, 2013
This code will read the running process from OS and display it (C++). Specifically, the OS here is Windows XP. The Problem(error) is in (i think) prototype. By the way, it displays following errors.
Error 1 : error LNK2019: unresolved external symbol _EnumProcesses@12 referenced in function _main
Error 2 : error LNK2019: unresolved external symbol _GetModuleBaseNameA@16 referenced in function "void __cdecl DisplayProcessNameAndID(unsigned long)" (?DisplayProcessNameAndID@@YAXK@Z)
Error 3 : error LNK2019: unresolved external symbol _EnumProcessModules@16 referenced in function "void __cdecl DisplayProcessNameAndID(unsigned long)" (?DisplayProcessNameAndID@@YAXK@Z)
Error 4 : fatal error LNK1120: 3 unresolved externals C:Documents and SettingsWindowsMy DocumentsVisual Studio 2008ProjectsaDebuga.exe
#include <afxwin.h>
#include <iostream>
#include <string.h>
#include "psapi.h"
unsigned int i;
using namespace std;
[Code] .....
View 2 Replies
View Related
May 12, 2013
I have a program that makes a directory (temporary) and in it some files that are necessary for computation while program is running. Now suppose a user decides to interrupt the program at some stage. what happens is that the program stops but my folder and files remain.
Q: How to override SIGINT command so that before the the execution stops the folder is deleted ?
View 4 Replies
View Related
Apr 25, 2014
I am encountering a problem on retrieving the Window Proc of a window that running in a process with another user.
For example, I have logon windows with domainuser1, and run the following command as:
runas /profile /env /user:domainuser2 C:WindowsSystem32calc.exe
And then the Calculator is shown in domainuser1 desktop, but the process is running in domainuser2 account.
When running Spy++ (either wither domainuser1 or domainuser2) to view the calculator window, the Windoe Proc field is shown 'Unavailable' I also try to call GetWindowLong against this window, it will always returns NULL.
I am just wondering if it is possible to retrieve the Window Proc of the window running in a process of another account, is is possible?
View 9 Replies
View Related
Dec 27, 2012
i am doing a structure program "struct book",but at the time of run cmd is opening and i am getting 'windows don't send' error and program has been terminating.
the code is following:
#include<stdio.h>
#include<conio.h>
display();
struct book
[Code]....
View 3 Replies
View Related
Jan 26, 2013
I have struggled to send email from my MFC applications using severl methods:
1) http via my server - works but limited
2) M$ Outlook automation - works but not easily interchangeable between machines
3) Windows Sockets - available information simply too complicated
4) Purchase an ActiveX control - I hate black box solutions and am too cheap
I have looked at P. J. Naughter's class
CPJNSMTPConnection v2.99
An MFC class to encapsulate the SMTP protocol
[URL]
This approach requires the implementation of OpenSSL which turns out to be nothing short of a nightmare to install (so I never got it to run). I am looking for an example of an application that utilizes SMTP via Windows sockets api.
View 6 Replies
View Related
Jun 21, 2012
I intend writing a Windows form c# application that freezes windows and disables all other running application in the background while executing for security reasons. How I could go about this?
View 1 Replies
View Related
Nov 15, 2013
I have a C++/MFC application that displays a count in a window:
The count (text) is displayed via a `CStatic` control. The mechanism is very simple. I call it every 1000 ms and update the text as such:
Code:
void CTestCountdownFlickerDlg::RedrawCounter(LPCTSTR pText)
{
CStatic* pTxtBox = (CStatic*)this->GetDlgItem(IDC_STATIC_COUNTER);
ASSERT(pTxtBox);
[Code]....
What happens is that the `CStatic` control updates without any issues on the OS with visual themes enabled, but if I run it on the OS with the Windows Classic theme (for instance, the screenshot above is from Windows 7) the `CStatic` control produces a visible flicker every time it updates the text.
Well, I understand that I'm nitpicking here, still I would really like to get rid of this flicker.
Here's what I tried:
1. In my actual project I tried subclassing the `CStatic` control and removed the processing of `WM_ERASEBACKGROUND` by simply returning 1. That didn't work.
2. In the same subclass for `CStatic` control I tried to override `WM_PAINT`, but that didn't work at all. So I'm not sure if I'm going too far with it at this point.
I'm attaching the C++/MFC source code for my test project .....
View 14 Replies
View Related
Jul 31, 2013
I wrote an application so I can manage the products for my e-commerce site. It uses MySQL 64 bit. Problem is some of my stores have in excess of 3 million products. The files that contain the data are all CSV. I parse the lines... format the data... write to table. On most of the stores which contain 10 - 60 thousand products it only takes max 3 min to write it all in. I have been running it on this one store for 6 hours now and it has barely made a dent. I know there are almost 3mil products in this one but it should be going much faster given what the speed was for the 60K stores. Is there a faster approach to handling a massive dump like this? I should also add that there are quite a few indexes. These indexes are there for ordering and fulltext search once the products have been activated on the site. I cannot create the table without the indexes and add them later since there is already preexisting data that is using the indexes.
View 2 Replies
View Related
Feb 6, 2014
I used to use OutputDebugString, and not using it now because it only allows to strings to be outputted, are there any methods that I can dump virtually anything to the console?
cout << thing << endl;
But what if I am not start running the program from the command prompt?
View 2 Replies
View Related
Dec 13, 2013
I'm using a library in my code in a file called "my_signal.c". In this file I've defined this function:
Code:
Sigfunc * signal(int signo, Sigfunc *func){
struct sigaction act, oact;
...
}
Since the signal function is also in file signal.h and I included it in "my_sygnal.h" file, I'm wondering why the compiler did not say anything about this "double declaration" of the function with the same name.
View 9 Replies
View Related
Oct 30, 2013
so i'm using scanf() this way
Code:
int i;
while (scanf("%i", &i))
printf("%i ", i);
printf("
done
");
i tried several combination of Ctrl+D and "Enter", it's not terminating, Ctrl+C just "cancels" the whole thing without printing "done", i'm running this on linux installed on a PC
View 9 Replies
View Related
Aug 16, 2013
My C++ application gets crashed after throwing the gdb core
"warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7fff79e54000"
Core was generated by `./server'.
Program terminated with signal 6, Aborted.
#0 0x0000003b67230265 in raise () from /lib64/libc.so.6
View 1 Replies
View Related
Dec 6, 2013
This can be done very easy, but I assume there is a better way to do it.
assume that I have a vector or a signal like
x=[1 1 1 1 1]
want to shift it by one unit to the right I have
x[n+1] gives
xn=[0 1 1 1 1 1]
and x[n-1] vies
xn=[1 1 1 1 0]
as you can see the length of the original vector or array does not change.
How can I solve this problem without specify the length of the output vector. The size of the output array should be the same as the input array, but I couldn't find a way to do it without adjusting the size.
View 2 Replies
View Related
Sep 29, 2014
gdb result is
Code:
Program received signal SIGSEGV, Segmentation fault.
isoc99_fscanf (stream=0x0, format=0x4014e0 "%u %u %u %u")
at isoc99_fscanf.c:30
30 isoc99_fscanf.c: No such file or directory. Code:
[Code].....
View 2 Replies
View Related
Nov 13, 2013
This code snippet compiles and runs fine
Code:
#include <stdio.h>
int main(void) {
int i, a[i];
i=2;
for(int n=0; n<=i; n++)
a[n]=0;
[Code] .....
It prints out 3 "0", but when slightly changed
Code:
#include <stdio.h>
int main(void) {
int i, a[i];
i=200;
for(int n=0; n<=i; n++)
[Code] ....
It compiles fine but core dumps when run, how come? i'm using gcc version 4.4.7, and compiling like this
gcc -std=c99 test.c -o test
View 14 Replies
View Related
Dec 4, 2014
I'm new in IPC. I would like to implement a signal of a new message, which calls the slot function, eg .:
Code:
msg_on_newMessange(type, &slotFunction);
My code:
Header file: messages.h
Parent file: parent.c
Child file: child.c
How can I do this ?
View 2 Replies
View Related
Apr 24, 2014
I am doing Histogram using pthreads and after long struggle on it.. finally it says 'Segmentation Fault (Core Dumped)'. I knew that error means something somewhere I am accessing to a wrong memory location.
Here is my code..
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
void Usage(char prog_name[]);
void Gen_data(void *p);
void Gen_bins(void *p);
int Which_bin(void *p);
void Print_histo(void *p);
[Code] ...
How to fix 'Segmentation Fault (Core Dumped)'?
View 2 Replies
View Related
Mar 21, 2013
Here is the code, and I can get it to compile successfully, but when I run the program, I get a "segmentation fault (core dumped)" error. I am guessing it might be related to a buffer overflow but I cannot say for sure.
Code:
#include <stdio.h>
typedef struc {
int recordNo;
char name[20];
int qty;
float cost;
[Code] .....
View 1 Replies
View Related
Dec 4, 2014
I need to set signal handler for my process. As the signal is related with the process on system level I have faced the problem. My program consists several classes. They are connected together. But it doesn't metter in this case. The problem is that I need to access to member and methods of the class from my signal handler. For instance , I have class named Foo at it has some members and methods.
So from my handler I need to call its function and change members. I understand that compiler should know that this class instances will exist during all program execution. I have tried to set static member class Foo instance in another class , but this didn't solve the problem. How to correctly implement signal handling in such case.
Here is example of my code
class MyContainer {
private:
std::vector<Foo> container;
public:
int removeFromContainer(Foo* aFoo) {
[Code] ....
View 1 Replies
View Related