How to keep on debugging after break in Windbg?

0

I've a sample code as follows:

#include<iostream>
#include<windows.h>
#include<tchar.h>
#include<float.h>
int _tmain(int argc, _TCHAR* argv[])
{
    unsigned int control_word;
    unsigned int cw = _controlfp_s(&control_word, 0, 0);
    cw &= ~(EM_OVERFLOW | EM_UNDERFLOW | EM_INEXACT | EM_ZERODIVIDE | EM_DENORMAL);
    _controlfp_s(&cw, 0, EM_ZERODIVIDE);

float i = -10;
long l = 100000L;

__try
{

    while ((i += 2) < 10)
    {
        printf("%.f", l / func(i));
        printf("%s", "\n");
    }
}
__except (EXCEPTION_EXECUTE_HANDLER) 
{
    switch (GetExceptionCode())
    {
    case EXCEPTION_FLT_DIVIDE_BY_ZERO: 
        printf("%s", "Error occured: division by zero");

        break;
    case EXCEPTION_ILLEGAL_INSTRUCTION:
        printf("%s", "Error occured: illegal instruction");
        break;
    default:
        exit(1);
    }
}

return 0;
}

This program is thought to run into DIVIDE_BY_ZERO exception. I apply WinDbg Preview to look into the exception after some primary settings is done:

Default symbol path: SRVC:\symbolshttp://msdl.microsoft.com/download/symbols Default source path: path to local .exe and .pdb files

Events and exceptions: System error: break Unknown exception: Break Handled C++ EH exception: Break Handled Control-C exception: Break Handled
Illegal Intruction: Ignore Not Handled Visual C++ exception: Ignore Not Handled

When I do debudding in Visual Studio 2019, the intended exception (DIVIDE_BY_ZERO) gets caught. However, WinDbg Preview stumbles at ILLEGAL_INSTRUCTION despite setting to ignore that. What I see in the command window, this outcome is below:

(de8.28dc): Unknown exception - code c00002b4 (first chance) First chance exceptions are reported before any exception handling. This exception may be expected and handled. eax=00000008 ebx=00fd8000 ecx=5bfaa76a edx=6b7a4a60 esi=010ffc1c edi=010ffc18 eip=0112d622 esp=010ffc1c ebp=010ffdfc iopl=0 nv up ei pl nz na po nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010202 ConsoleApplication3!wmain+0x172: 0112d622 f30f5945c4 mulss xmm0,dword ptr [ebp-3Ch] ss:002b:010ffdc0=7e876abd NatVis script unloaded from 'C:\Program Files\WindowsApps\Microsoft.WinDbg_1.1908.30002.0_neutral__8wekyb3d8bbwe\x86\Visualizers\atlmfc.natvis' NatVis script unloaded from 'C:\Program Files\WindowsApps\Microsoft.WinDbg_1.1908.30002.0_neutral__8wekyb3d8bbwe\x86\Visualizers\concurrency.natvis' NatVis script unloaded from 'C:\Program Files\WindowsApps\Microsoft.WinDbg_1.1908.30002.0_neutral__8wekyb3d8bbwe\x86\Visualizers\cpp_rest.natvis' NatVis script unloaded from 'C:\Program Files\WindowsApps\Microsoft.WinDbg_1.1908.30002.0_neutral__8wekyb3d8bbwe\x86\Visualizers\stl.natvis' NatVis script unloaded from 'C:\Program Files\WindowsApps\Microsoft.WinDbg_1.1908.30002.0_neutral__8wekyb3d8bbwe\x86\Visualizers\Windows.Data.Json.natvis' NatVis script unloaded from 'C:\Program Files\WindowsApps\Microsoft.WinDbg_1.1908.30002.0_neutral__8wekyb3d8bbwe\x86\Visualizers\Windows.Devices.Geolocation.natvis' NatVis script unloaded from 'C:\Program Files\WindowsApps\Microsoft.WinDbg_1.1908.30002.0_neutral__8wekyb3d8bbwe\x86\Visualizers\Windows.Devices.Sensors.natvis' NatVis script unloaded from 'C:\Program Files\WindowsApps\Microsoft.WinDbg_1.1908.30002.0_neutral__8wekyb3d8bbwe\x86\Visualizers\Windows.Media.natvis' NatVis script unloaded from 'C:\Program Files\WindowsApps\Microsoft.WinDbg_1.1908.30002.0_neutral__8wekyb3d8bbwe\x86\Visualizers\windows.natvis' NatVis script unloaded from 'C:\Program Files\WindowsApps\Microsoft.WinDbg_1.1908.30002.0_neutral__8wekyb3d8bbwe\x86\Visualizers\winrt.natvis'

In the source code window an instruction becomes highlighted: case EXCEPTION_ILLEGAL_INSTRUCTION:

that is meant to be as a result from the same exception. However I'm trying to go on, there is no proceeding by clicking go. Therefore I've two issues: 1) What is a way to keep on debugging until DIVIDE_BY_ZERO occurs afterwards (I wonder also why ILLEGAL_INSTRUCTION was caught under ignoring setting)? 2) What are web articles, posts, tutorials that will provide with a practical sample how to use WinDbg? I was seeking any comprehensible beginner's guideline across Internet, but nothing like that seems to be present among my search results. I need an introducing guide or similar item for students in system programming, so one would contain practical step-by-step solution, rather than brief presentation of WinDbg followed by a list of hard-core commands.

Every advise will be appreciated, sure.

Max_ReFactor

Posted 2019-09-26T18:38:10.550

Reputation: 1

No answers