Coredump Analysis [closed] - c++

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have observed a core dump on a UNIX server and have to analyze the cause behind it.
Following is the output of coredump using mdb
Loading modules: [ libc.so.1 libuutil.so.1 ld.so.1 ]
> ::status
debugging core file of pmr_colld_aos (32-bit) from atrcxb2532
file: /opt/ericsson/aos/PDM/bin/pmr_colld_aos
initial argv: /opt/ericsson/aos/PDM/bin/pmr_colld_aos -ORBInitRef NameService=corbaloc::maste
threading model: multi-threaded
status: process terminated by SIGABRT (Abort)
> ::stack
libc.so.1`_lwp_kill+0x15(1, 6)
libc.so.1`raise+0x1f(6)
libc.so.1`abort+0xcd(8026ad0, 8eb2d88, 0, fe2cb9d0, 8ea9f50, 80275b0)
libstdc++.so.6.0.3`_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0xdf(fe2eb0c0, fe2cb9d0, 8026a78, fe2b53cc, fe2b7298, 8ea9f50)
libstdc++.so.6.0.3`_ZN10__cxxabiv111__terminateEPFvvE+0x14(fe2b7298, 8ea9f50, 8026a88, fe2b467a, feffd888, fe2cb9d0)
libstdc++.so.6.0.3`_ZN10__cxxabiv112__unexpectedEPFvvE(1, fe2cb9d0, 8026af8, fe2b52d6, fe2b53ac, fe217a44)
libstdc++.so.6.0.3`_ZN10__cxxabiv112__unexpectedEPFvvE+0x14(fe2b53ac, fe217a44, feffa320, 0, 8026ad8, fe2b7298)
libstdc++.so.6.0.3`__cxa_call_unexpected+0x42(8ea9f80, 8026b40, 8c70120, 82aa448, 8e382a8, 8026b20)
_ZN21PDRFileTimeoutHandler5checkEv+0xa10(fe17f000, fdfa2a00, 8026c90, fe0a5bf6, fe180680, 0)
main+0x1309(2, 8026e10, 8026e24)
_start+0x80(4, 8027618, 8027682, 802764c, 8027640, 0)
> $C
080269c4 libc.so.1`_lwp_kill+0x15(1, 6)
080269dc libc.so.1`raise+0x1f(6)
08026a28 libc.so.1`abort+0xcd(8026ad0, 8eb2d88, 0, fe2cb9d0, 8ea9f50, 80275b0)
08026a48 libstdc++.so.6.0.3`_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0xdf(fe2eb0c0, fe2cb9d0, 8026a78, fe2b53cc, fe2b7298, 8ea9f50)
08026a58 libstdc++.so.6.0.3`_ZN10__cxxabiv111__terminateEPFvvE+0x14(fe2b7298, 8ea9f50, 8026a88, fe2b467a, feffd888, fe2cb9d0)
08026a78 libstdc++.so.6.0.3`_ZN10__cxxabiv112__unexpectedEPFvvE(1, fe2cb9d0, 8026af8, fe2b52d6, fe2b53ac, fe217a44)
08026a88 libstdc++.so.6.0.3`_ZN10__cxxabiv112__unexpectedEPFvvE+0x14(fe2b53ac, fe217a44, feffa320, 0, 8026ad8, fe2b7298)
08026af8 libstdc++.so.6.0.3`__cxa_call_unexpected+0x42(8ea9f80, 8026b40, 8c70120, 82aa448, 8e382a8, 8026b20)
08026c68 _ZN21PDRFileTimeoutHandler5checkEv+0xa10(fe17f000, fdfa2a00, 8026c90, fe0a5bf6, fe180680, 0)
08026dec main+0x1309(2, 8026e10, 8026e24)
08026e04 _start+0x80(4, 8027618, 8027682, 802764c, 8027640, 0)
> $G
C++ symbol demangling enabled
> ::quit
Can anyone help me in understanding this output?
Please note that the code has been written in the pmr_colld_aos in directory - /opt/ericsson/aos/PDM/bin/pmr_colld_aos.
Also, I just want to know how to understand such outputs which will help me in backtracing the code.

What you got there is the backtrace of the crash. The last routine that's part of the program was FileTimeoutHandler5checkEv() so it's likely that the error is in there. Everything after this point is part of the C++ library.
But if you really want to examine it, then you should load the core file into GDB along with the program that caused it. It's way easier than examining the core file with mdb.

Related

"string too long" crash, c++ [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 days ago.
Improve this question
im crashing on xstring with this error, can't figure out why
error:
the piece of code where its crashing on:
std::string response = f_network.request_to_server((xorstr_("a=") + crypt.rsa_enc(params.m_cUsername) + xorstr_("&b=") + crypt.rsa_enc(params.m_cPassword) + xorstr_("&c=") + crypt.rsa_enc(f_main.get_hwid()) + xorstr_("&pc=") + f_main.base64_encode(reinterpret_cast<unsigned char*>(hwid_part.data()), hwid_part.length())));
im using VS 2022, with the latest SDK
I already enabled multi-byte character set, but that didn't change anything, im desperate
this is a request to my API, where it asks for the username and password, i don't know why its crashing tho, i've tried everything i could, and it doesn't seem to work

object is not being saved even after fstream.clear() in c++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am using C++ to write a music memorize game for my school project, here the Player objects are not being saved in the PLAYER_DATA.DAT file even i tried clear() function
here is the peace of code (as the whole code is 600+ lines)
Player p_dat,plyr;
plyr.getData();
fstream P_file("PLAYER_DATA.DAT",ios::out|ios::in|ios::binary);
while(P_file.read((char*)&p_dat, sizeof(p_dat)))
{
if(nameEqual(plyr,p_dat))
{
P_file.clear();
gotoxy(1,10);
delline();
textcolor(RED);
cout<<"\t\t EXIXTING PLAYER PROFILE FOUND!\n";
int ch = playPanel("It's me", "Change Name");
if(ch == 0)
{
P_file.seekp(P_file.tellg() - sizeof(Player));
GameStarted = 1;
if(c == 1)
Campaign(p_dat,P_file);
else
Endless(p_dat,P_file);
return;
}
else
{
startGame(c);
return;
}
}
}
P_file.clear();
P_file.seekp(0,ios::end);
P_file.write((char*)&plyr,sizeof(plyr));
Just to make it short, The last line of the code is not doing anything the file already exists and of size 0kb
however,
fstream P_file("PLAYER_DATA.DAT",ios::out|ios::in|ios::binary)
P_file.write((char*)&plyr,sizeof(plyr));
is saving the file. Please help me.
EDIT 1.1
finally found this line is problematic
P_file.seekp(0,ios::end);
Its working for code, i.e correctly saving objects
P_file.clear();
P_file.write((char*)&plyr,sizeof(plyr));
P_file.seekp(0,ios::end);
while removing
P_file.seekp(0,ios::end);
making the code look like,
P_file.clear();
P_file.write((char*)&plyr,sizeof(plyr));
after the while loop, is not saving the file
again does not save the object
this line is making problem, are there any alternatives or solutions?
Compile with all warnings and debug info (g++ -Wall -Wextra -g with GCC) then use the debugger (e.g. gdb).
Read carefully documentation of C++ IO functions.
Check that your file has been opened correctly; after:
fstream P_file("PLAYER_DATA.DAT",ios::out|ios::in|ios::binary);
add
if (!P_file) { std::cerr << "failed to open PLAYER_DATA.DAT" << std::endl; };
On some systems (e.g. Linux), you might also display strerror(errno).
After some intermediate call to write, consider using flush.
Be sure that your program is started in the correct working directory.
On Linux, you might also use strace(1) to understand the system calls done by your program.
At last, did you consider using some simple database, e.g. with sqlite, or some indexed file, e.g. with gdbm ?

Probable reasons for Illegal seek in socket programming [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have received following error while sending data.
send:29-Illegal seek
Please explain the probable reasons for it. I am new to socket programming. Thanks in advance.
CHAR datasend[200];
DOUBLE64 fTime=0.0;
LONG32 sent_bytes=0;
while(TRUE)
{
memset(datasend,0,200);
fTime=getTime();
sprintf(datasend,"0=%.0lf ",fTime);
sent_bytes = send ( isockfd, datasend, strlen(datasend),0);
logDebug1("Pulse is %s and data bytes is %d",datasend,strlen(datasend));
if(sent_bytes <= 0)
{
logPError("send");
logTimestamp("Closing socket\n");
close(isockfd);
return NULL;
}
sleep(25);
}
You're not interpreting the right error because of the intervening logDebug1 call.
You have a send that returns something <= 0 and possibly an errno that you could inspect
You print something (logDebug1) which likely clobbers errno
You do some sort of perror which interprets the clobbered errno
What you want to do instead is check if sentBytes < 0, perror immediately and then maybe print more debugging stuff if you want.

How to explain the strange output by "puts" in c++? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I am reading a piece of code written by others, there is one line like this:
cout << "Data Loaded" << endl;
it seems nothing strange, however, the actually output is:
[18607330327, 18790481919] [19144201237, 19327352831] [20754813973, 20937965567] [21291684885, 21474836479] [21474836482, 21653864362] [22011707392, 22190735274] [23622320128, 23801348010] [24159191040, 24338218922] [27197264917, 27204255743] [27205653525, 27212644351] [27230819349, 27230959453] [27233615872, 27235153757] [30064771072, 30067638186] [30073159680, 30076026794] [30098325504, 30098440106] [30098456576, 30098536200] Data Loaded
where does the extra output come from? if I comment that line, then, nothing is output.
I then include the <cstdio> and replace that line by puts("Data Loaded"), still, the extra info get printed.
cout is a buffered output stream, and endl not only creates a new line, it also flushes the buffer. Without the flushing of the buffer it might happen that you do not see the output of a previous cout.

How can i make my program run automatically in python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I export my python code by pyinstaller i need my program to startup automatically whith the windows (i don't need to do that by startup folder)
First you need to create a shortcut. This will create shortcut on your desktop
import os, sys
import pythoncom
from win32com.shell import shell, shellcon
shortcut = pythoncom.CoCreateInstance (
shell.CLSID_ShellLink,
None,
pythoncom.CLSCTX_INPROC_SERVER,
shell.IID_IShellLink
)
shortcut.SetPath (sys.executable)
shortcut.SetDescription ("Python %s" % sys.version)
shortcut.SetIconLocation (sys.executable, 0)
desktop_path = shell.SHGetFolderPath (0, shellcon.CSIDL_DESKTOP, 0, 0)
persist_file = shortcut.QueryInterface (pythoncom.IID_IPersistFile)
persist_file.Save (os.path.join (desktop_path, "python.lnk"), 0)
You can make toany of windows locations for startup files ( or create it only in startup place) :
Run Once :HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
Run each Start: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
StartUp folder : C:\Documents and Settings\All Users\Start Menu\Programs\Startup
Shared Task Manager : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SharedTaskScheduler
Make it as a service, and make that service automatic started
To see what programs start automatically on your computer, or to add your entries easy, you can use autoruns from SysInternals, http://technet.microsoft.com/en-us/sysinternals/bb963902.aspx
P.S. Python example is from timgolden.me.uk site.