Forum > Debugger

How to get GDB to transfer control to exception handler ?

(1/2) > >>

440bx:
Hello,

I have a simple exception handler to work around an occasional problem.  The code is as follows:
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    {$ifdef UseWordAccessWorkaround}      try        { FPC v3.0.4 generates a word access for the expression below.  This  }        { causes an access violation if the last byte in the block is also    }        { last accessible byte.  The try/except is to work around that bug.   }         HexPtr^ := HexDigits[p^ and $F];           { second nibble            }      except        b := p^;                                   { these instructions do    }        b := b and $F;                             { not generate a word      }        HexPtr^ := HexDigits[b];                   { access.                  }      end;    {$endif} when the program is executed from the command line, the exception handler handles the exception and execution resumes normally.

When running the program under GDB, GDB gets "stuck" at
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---       HexPtr^ := HexDigits[p^ and $F];           { second instead of transferring control to the exception handler.

the question is: how do I tell GDB to transfer control to the exception handler so execution resumes normally ?  F7/F8/F9 only seem to cause the exception again.

Attached is a complete sample program which executes as it should when invoked on the command line but gets stuck on the offending line as described above when run under GDB.

Thank you for your help.

PS: FPC v3.0.4, Windows 7 64bit. 

Cyrax:
Are you building a 32-bit or 64-bit binary?

440bx:

--- Quote from: Cyrax on March 05, 2019, 12:05:49 pm ---Are you building a 32-bit or 64-bit binary?

--- End quote ---
Both.  Can't get past the exception in either bitness.

Martin_fr:
It works on Windows 10 64 bit. (continue running)

IIRC, there are issues with either gdb, or rumour has it windows itself. That is I remember on my older system (Vista) I was not able to continue after such an exception.
I do not know what makes the difference.

You can try the following.
1) get gdb 8.2 from our sourceforge page.
2) use fpdebug (might need Lazarus trunk, might work on 2.0... not sure)

440bx:

--- Quote from: Martin_fr on March 05, 2019, 01:20:47 pm ---You can try the following.
1) get gdb 8.2 from our sourceforge page.
2) use fpdebug (might need Lazarus trunk, might work on 2.0... not sure)

--- End quote ---
Thank you Martin, I will try your suggestions. 

Navigation

[0] Message Index

[#] Next page

Go to full version