Click here to Skip to main content
13,596,178 members
Click here to Skip to main content


28 bookmarked
Posted 21 Aug 2009
Licenced CPOL

Post mortem C++ exception analysis in embedded applications

, 21 Aug 2009
An article on analysing a program exception or software crash.
#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>
#include <iostream>
#include "C4.h"
#include "ex.h"

std::map<unsigned long, std::wstring> theExceptionTable;
std::wstring theRootPath;

void Test1()
	long data = -1;

	std::cout << "Running CallStackTest..." << std::endl;

	C4 c4;
	data = c4.Test4(100.200);

	std::cout << data << std::endl;
	std::cout << "CallStackTest finished." << std::endl;

DWORD WINAPI ThreadProc(LPVOID lpParameter)

	return 0;

int _tmain(int argc, _TCHAR* argv[])
    // Prepare 
    wchar_t fullPath[512];
    wchar_t rootPath[512];
    wcscpy_s(fullPath, 512, argv[0]);
    wchar_t* dot = wcsrchr(fullPath, L'.');
    wchar_t* backslash = wcsrchr(fullPath, L'\\');
    wcscpy_s(dot, 512 - (wcslen(fullPath) - wcslen(L".exe")), L".map");
    int c = backslash - fullPath;
    wcsncpy_s(rootPath, 512, fullPath, c);

    theRootPath = rootPath;
    theExceptionTable = LoadAsm(fullPath);

    // Go ahead with test
    // Either in main() thread context or a new thread
#if 0
	DWORD threadID=0;
	CreateThread(NULL, 0, ThreadProc, NULL, 0, &threadID);


	return 0;

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Werner Willemsens
Team Leader
Belgium Belgium
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03-2016 | 2.8.180621.3 | Last Updated 21 Aug 2009
Article Copyright 2009 by Werner Willemsens
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid