Exception position in try - catch - block

delphi package - automated exception handling

Exception position in try - catch - block

Postby n2iewerth » Thu Dec 20, 2018 10:24 am

Hi forum,

I have a question regarding exception location.
When running inside a catch block and an exception occures I can dump the stack trace when entering the catch block.
But I have only the routine where the exception occured and not the exact position inside this routine.
I use the function

AutoSaveBugReport(CreateBugReport())

Does one know how to determin the exact position where an exception occured?

Regards
Norbert
n2iewerth
 
Posts: 2
Joined: Wed Dec 19, 2018 9:31 pm

Re: Exception position in try - catch - block

Postby madshi » Sun Dec 23, 2018 1:07 pm

Do you need the full bug report, or just the stack trace? If you need just the stack trace, please use "madExcept.GetCrashStackTrace()":

http://help.madshi.net/madExceptUnit.ht ... StackTrace

If you need the full bug report, CreateBugReport() is the right API to use, but then please make sure the first parameter is set to "etNormal".

Also please make sure you run the latest 4.0.21 or 5.0 build, which has some improvements for x64 stack tracing.
madshi
Site Admin
 
Posts: 9931
Joined: Sun Mar 21, 2004 5:25 pm

Re: Exception position in try - catch - block

Postby n2iewerth » Mon Jan 14, 2019 10:36 am

I am using the latest version of MadException (4.0.21)
But I still get just the information of the routine with the try block where the exception occured.
Even a routine inside this try block will not be reported.

Example:

Code: Select all
void foo(char *x)
{
  *x = 0;
}

void fuu()
{
  try
  {
    foo(NULL); //should crash in foo
  }
  catch(...)
  {
    AutoSaveBugReport(CreateBugReport(etNormal)); //no foo here in; last position is fuu that is reported
  } 
}


I would like to see the line number of foo in the crash report (because here the exception occured)

Is this possible?
n2iewerth
 
Posts: 2
Joined: Wed Dec 19, 2018 9:31 pm

Re: Exception position in try - catch - block

Postby madshi » Mon Jan 14, 2019 1:45 pm

Just tested your exact code and it produces a perfect bug report on my PC. Testing with BCB 10.3 32bit, using classic compiler.

Do you have madExcept enabled in your project? Does madExcept automatically catch exceptions, if you don't use a try..except/catch block?
madshi
Site Admin
 
Posts: 9931
Joined: Sun Mar 21, 2004 5:25 pm


Return to madExcept

Who is online

Users browsing this forum: No registered users and 7 guests

cron