How to Debug a Linux Core Dump Using Vscode

Debug linux crash dump on Windows

You can use GDB on Windows for that, if it was compiled with support for Linux targets. But you still need the binaries and symbols.

(Sorry, I don't know if VSCode comes with such a GDB)

GDB With a coredump file in linux

If your core file is core just run

gdb ./my_prog core

to do some post-mortem analysis with the core.

If you want to use gdb without your core, consider

gdb --args ./my_prog arg

or else run just gdb ./my_prog then issue the set args command to gdb.

If your process is still running as pid 1234, you could with gdb ./my_prog 1234 attach the gdb to the running process.

You really should read the gdb documentation.

Segmentation Fault (Core Dump) - Code works in VS but not in the Linux Terminal

I don't see any sign of TsuPod::songs being initialized. There is no guarantee that it's going to be NULL in the empty list case, so your

while (p != NULL)

test in TsuPod::getRemainingMemory() may pass with an insane value from the stack and blow up when you use p on the next line.

I recommend

TsuPod::TsuPod():songs(NULL) //default constructor
{
memSize = MAX_SIZE;
}

TsuPod::TsuPod(int _size):songs(NULL) //constructor for when user specifies their prefered memory size, prevents input of a size greater than MAX_SIZE or less than 0
{
if (_size > MAX_SIZE || _size <= 0)
memSize = MAX_SIZE;
else
memSize = _size;
}

to ensure that songs starts with your end of list condition.

Also, consider using std::list to do your list management in place of the roll-your-own linked list.

Vscode, python segmentation fault(core dumped)

It's probability the VS code polluted the python enviroment. You can uninstall the python enviroment and reinstall a new clean enviroment. If you use conda, you can update the enviroment by conda update --all.



Related Topics



Leave a reply



Submit