How to analyse a coredump file of GDB [closed] - gdb

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How to analyse a coredump file of GDB.

GDB can get you started:
$ gdb --help
This is the GNU debugger. Usage:
gdb [options] [executable-file [core-file or process-id]]
gdb [options] --args executable-file [inferior-arguments ...]
[snip extended docs]
So, you'll invoke it like this:
gdb myprog core
GDB will then start in the usual way, but the state will be as if you'd stopped at a breakpoint. You can then use "print", "examine", "list", "backtrace", "up", "down", etc. to investigate what caused the crash.
In fact, you can use any GDB command except "continue", "step", "next", or anything else that requires an actual running program.

Related

How to debug a g++ segmentation fault using gdb? [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 3 years ago.
Improve this question
I got a segfault when running my program. Then I googled my question and tried to follow steps from https://www.gnu.org/software/gcc/bugs/segfault.html.
I did not configure GCC with --enable-checking then my first question is -
1) is it necessary to configure it and compile with -v -da -Q ?
But I always do compile with flags such as -g -o0. After running the program in GDB with arguments I get this:
2) I can not print variables after segfault, is it okay ?
3) How to figure out the line of my source code where segfault happens ?
Then I googled my question and tried to follow steps from > https://www.gnu.org/software/gcc/bugs/segfault.html.
These are the steps for GCC developers to follow when GCC itself crashes while compiling your program.
These are not the steps you should follow when debugging a crash in the program itself.
Instead, read this.
How to figure out the line of my source code where segfault happens ?
GDB told you the line: it's common/search.cpp line 172.

SegmentationFault linux AFS [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Can someone tell me how to debug segmentation fault in linux VIA AFS. I would appreciate if someone could refer me command. I am able to run my code via compiler but not on when i give command g++ -o file1 file2.cpp----> ./file----->segmentation fault
Compile the program with the -g option
g++ -g -o file1 file2.cpp
Then execute the executable created with gdb.
gdb file1
Once you see the seg fault issue bt, this will give you the stack.
frame <frame number> you can see the details about the particular stack.
Happy debugging.

Running a c++ file from command line [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 8 years ago.
Improve this question
I'm very much used to Visual Studio, but a HW assignment requires that the finished product be run from the command line. I've built it in Visual Studio to make sure my code is at least syntactically correct and won't cause any compiler to throw me a message, but he designed the template so that it would only really work on Command Line. Therefore, I need the command line to test the functionality of the code
TL/DR: the jist of it is: I should be able to run it from command line by typing in:
programName argument
How do I do this with a .cpp?
It should be
Programname.exe argument 1 argument2 ... argumentn
Make sure you're running the program in the correct path or specify the full path of the .exe
First open command prompt than type cd and your file's location ( Bot don't write your program's name.Example we have a test.exe in our desktop. If we open the command prompt we will see something like this: C:\Users\Username\ : We should locate the file so we can do : cd C:\Users\Username\Desktop or cd Desktop This one works if the directed folder is a sub folder of Username .Than you can use this code : start test.exe. hope this helps.Please send a feedback.

CS107 Assignment Files [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 8 years ago.
Improve this question
I'm trying to run the Stanford CS107 Assignment files on my mac but whenever I try to run the binary files I get an error 'Permission denied'. If I chmod the file so I have execute permissions I get an error that says 'cannot execute binary file'.
How can I execute these files?
I can't run the imdb-test-linux binary because all the source files aren't given. To get the imdb-test file to run there was a problem in the imdb-utils.h file. The code uses
const char *ostype = getenv("OSTYPE");
Which returns Null on my mac for some reason. To fix the problem, in the 'determinePathToData' function inside the imdb-utils.h file just return the directory where you have placed the data files.
run 'make imdb-test' and it should run.
Hope this helps someone :)

Fatal Error while Running c++ object file [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 8 years ago.
Improve this question
I have compiled C++ project using cmake utility on Red hat Linux 4.1.2.
gcc version: 4.1
When I try to run object file using following command I got an exception:
./GCVMP ../../dat/settlingsUnix/MPSettings.xml
exception : Fatal Error: æ¹¥åSä
I am not able to understand root cause.
Please help me in this regard.
I suspect that the "Fatal Error:" portion is something printed by your code. It's supposed to be followed by a message explaining the error, but the message passed is corrupted, and so junk is printed.
Have you tried compiling the program with -ggdb running it under gdb? Here's a good starter on how to use the debugger: http://www.ibm.com/developerworks/library/l-gdb/