1. Debugging "A machine-level exception"

Hi,

I look after a few applications that crash from time to time. Usually I can use the ex.err to track down the fault in the source code. Occassionally the crash message is "A machine level exception occurred during execution of this statement". These ones leave me a little nonplussed. The crashes occur infrequently and across a large range of different machines. Whenever I ask the user for more information I get the conversational equilvalent of a shrug. The users are half way across the country from me, and so I can't watch it happen and the user can't reproduce it.

Can anyone offer me some help on how to diagnose faults like this one

  • C:\EUPHORIA\include\machine.e:296 in function allocate_string()
    A machine-level exception occurred during execution of this statement
    s = {}
    mem = <no value>
    
  • ... called from .\Common\Private\dlla2.e:121 in function dllFunc()
    nama = {71'G',101'e',116't',80'P',114'r',105'i',118'v',97'a',116't',101'e',
    80'P',114'r',111'o',102'f',105'i',108'l',101'e',83'S',116't',114'r',105'i',
    110'n',103'g',65'A'}
    par = {
    9702016,
    9702016,
    {},
    {32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',
    32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',
    32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',
    32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',
    <snip>
    

or this one

  • C:\EUPHORIA\Private/eucom.ew:1626 in function quick_activate()
    A machine-level exception occurred during execution of this statement
    obj_ix = 1
    fore_color = 0
    back_color = 16777215
    pfont = 12771300
    this = 8743612
    clientsite = 1293764
    advisesink = 0
    pcontainer = <no value>
    pcontrol = <no value>
    mset = 8733316
    ok = <no value>
    ppvIFont = 1623196
    riid = 9406540
    ppvClient = <no value>
    ppvAdvise = <no value>
    ppvUnk = <no value>
    iocs = <no value>
    duh = <no value>
    vtbl = <no value>
    
  • ... called from C:\EUPHORIA\Private/eucom.ew:2422 in procedure init_control()
    obj_ix = 1
    ok = <no value>
    mset = <no value>
    <snip>
    

Cheers,
Mark
P.S. I'm sorry if my use of forum tags is all wrong. I tried a large number of combinations before settling on this look.

new topic     » topic index » view message » categorize

2. Re: Debugging "A machine-level exception"

Regarding the second one, looking at eucom.ew I found this lines: ok = c_func( OleCreateFontIndirect, { pfont, riid, ppvIFont } ) pfont = peek4u( ppvIFont ) According to the error, the second one (line 1626) is giving an error, probably because it's trying to peek from a bad pointer. Looking at OleCreateFontIndirect documentation, I found this: "If unsuccessful, the value of *ppvObj is set to NULL.". ppvObj is ppvIFont on Eucom's code, so probably the function is failing and the pointer is set to null, then peek tries to read from there, and it fails. Adding an error check on Eucom should fix that crash at least, it'll be better to see why OleCreateFontIndirect is failing.

You can try compiling with safe.e, it's slower but safer :)

new topic     » goto parent     » topic index » view message » categorize

3. Re: Debugging "A machine-level exception"

Sorry about the badly formatted message.
Regarding the second error again, here's some code that will help you debug that one.
According to the documentation, OleCreateFontIndirect returns E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, E_NOINTERFACE and E_POINTER errors.
Eucom has routines to check for errors, they're just not used there, until now :)
On eucom.ew, quick_activate function add below the line:

    ok = c_func( OleCreateFontIndirect, { pfont, riid, ppvIFont } ) 

This code:

    if is_error(ok) then 
        com_err_out(1)  -- Print the error on console 
        com_error(ok)   -- Display the error on console 
        while get_key() = -1 do -- Wait for key press 
        end while 
        ?1/0 -- Crash 
    end if 
new topic     » goto parent     » topic index » view message » categorize

4. Re: Debugging "A machine-level exception"

marky1124 said...

Hi,

I look after a few applications that crash from time to time. Usually I can use the ex.err to track down the fault in the source code. Occassionally the crash message is "A machine level exception occurred during execution of this statement". These ones leave me a little nonplussed. The crashes occur infrequently and across a large range of different machines. Whenever I ask the user for more information I get the conversational equilvalent of a shrug. The users are half way across the country from me, and so I can't watch it happen and the user can't reproduce it.

Can anyone offer me some help on how to diagnose faults like this one

  • C:\EUPHORIA\include\machine.e:296 in function allocate_string()
    A machine-level exception occurred during execution of this statement
    s = {}
    mem = <no value>
    
  • ... called from .\Common\Private\dlla2.e:121 in function dllFunc()
    nama = {71'G',101'e',116't',80'P',114'r',105'i',118'v',97'a',116't',101'e',
    80'P',114'r',111'o',102'f',105'i',108'l',101'e',83'S',116't',114'r',105'i',
    110'n',103'g',65'A'}
    par = {
    9702016,
    9702016,
    {},
    {32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',
    32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',
    32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',
    32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',32' ',
    <snip>
    

or this one

  • C:\EUPHORIA\Private/eucom.ew:1626 in function quick_activate()
    A machine-level exception occurred during execution of this statement
    obj_ix = 1
    fore_color = 0
    back_color = 16777215
    pfont = 12771300
    this = 8743612
    clientsite = 1293764
    advisesink = 0
    pcontainer = <no value>
    pcontrol = <no value>
    mset = 8733316
    ok = <no value>
    ppvIFont = 1623196
    riid = 9406540
    ppvClient = <no value>
    ppvAdvise = <no value>
    ppvUnk = <no value>
    iocs = <no value>
    duh = <no value>
    vtbl = <no value>
    
  • ... called from C:\EUPHORIA\Private/eucom.ew:2422 in procedure init_control()
    obj_ix = 1
    ok = <no value>
    mset = <no value>
    <snip>
    

Cheers,
Mark
P.S. I'm sorry if my use of forum tags is all wrong. I tried a large number of combinations before settling on this look.

Mark: It looks like both of these machine-level exception
in my opinion are memory related.

The first example's clue is:

mem = <no value>

The second example's clue is:

mset = <no value>

new topic     » goto parent     » topic index » view message » categorize

5. Re: Debugging "A machine-level exception"

gbonvehi said...

According to the documentation, OleCreateFontIndirect returns E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, E_NOINTERFACE and E_POINTER errors.
Eucom has routines to check for errors, they're just not used there, until now :)
On eucom.ew, quick_activate function add below the line:

    ok = c_func( OleCreateFontIndirect, { pfont, riid, ppvIFont } ) 

This code:

    if is_error(ok) then 
        com_err_out(1)  -- Print the error on console 
        com_error(ok)   -- Display the error on console 
        while get_key() = -1 do -- Wait for key press 
        end while 
        ?1/0 -- Crash 
    end if 

Hi gbonvehi, bernie,

Thank you for your replies. I certainly am not ruling out the cause being a memory fault, but I'm not 100% sure how to judge. Still pursuing the 2nd crash if we look at the values we see

  • pfont = 12771300
  • mset = 8733316
  • ppvIFont = 1623916
  • riid = 9406540

None are a NULL value.

I like your suggestion to do proper error checking, however the crash was attributed to this line 1626:-

    ok = c_func( OleCreateFontIndirect, { pfont, riid, ppvIFont } ) 

so we'd not get a chance to do any subsequent is_error(ok) checks since we've already crashed. Presumably we should be checking the return values from

    ppvIFont = w32acquire_mem( mset, 4 ) 
    riid = w32acquire_mem( mset, string_to_guid( IFont_ ) ) 

Would they be NULL if there was no memory available?

We crashed within OleCreateFontIndirect. I found the OleCreateFontIndirect documentation, thank you for suggesting that. So I'm guessing the most important thing would be to try and see what that call returned.

How can I go about achieving that?
Is it possible from the ex.err I already have?

Cheers,
Mark

new topic     » goto parent     » topic index » view message » categorize

6. Re: Debugging "A machine-level exception"

marky1124 said...
gbonvehi said...

According to the documentation, OleCreateFontIndirect returns E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, E_NOINTERFACE and E_POINTER errors.
Eucom has routines to check for errors, they're just not used there, until now :)
On eucom.ew, quick_activate function add below the line:

    ok = c_func( OleCreateFontIndirect, { pfont, riid, ppvIFont } ) 

This code:

    if is_error(ok) then 
        com_err_out(1)  -- Print the error on console 
        com_error(ok)   -- Display the error on console 
        while get_key() = -1 do -- Wait for key press 
        end while 
        ?1/0 -- Crash 
    end if 

Hi gbonvehi, bernie,

Thank you for your replies. I certainly am not ruling out the cause being a memory fault, but I'm not 100% sure how to judge. Still pursuing the 2nd crash if we look at the values we see

  • pfont = 12771300
  • mset = 8733316
  • ppvIFont = 1623916
  • riid = 9406540

None are a NULL value.

I like your suggestion to do proper error checking, however the crash was attributed to this line 1626:-

    ok = c_func( OleCreateFontIndirect, { pfont, riid, ppvIFont } ) 

so we'd not get a chance to do any subsequent is_error(ok) checks since we've already crashed. Presumably we should be checking the return values from

    ppvIFont = w32acquire_mem( mset, 4 ) 
    riid = w32acquire_mem( mset, string_to_guid( IFont_ ) ) 

Would they be NULL if there was no memory available?

We crashed within OleCreateFontIndirect. I found the OleCreateFontIndirect documentation, thank you for suggesting that. So I'm guessing the most important thing would be to try and see what that call returned.

How can I go about achieving that?
Is it possible from the ex.err I already have?

Cheers,
Mark

Mark:

-- Isn't ppvIFont a pointer to a pointer ?? 
 
atom output_variable, ppvIFont  
 
  output_variable = w32acquire_mem( mset, 4 ) 
  ppvIFont = w32acquire_mem( mset, 4 ) 
  poke4(ppvIFont,output_variable) 
 
-- ppvIFont now contains pointer to the output_variable pointer.  
new topic     » goto parent     » topic index » view message » categorize

7. Re: Debugging "A machine-level exception"

bernie said...
-- Isn't ppvIFont a pointer to a pointer ?? 
 
atom output_variable, ppvIFont  
 
  output_variable = w32acquire_mem( mset, 4 ) 
  ppvIFont = w32acquire_mem( mset, 4 ) 
  poke4(ppvIFont,output_variable) 
 
-- ppvIFont now contains pointer to the output_variable pointer.  

I don't know. I've searched my source code and I don't have those lines at all. Perhaps I have a different eucom. I downloaded and checked and I have the latest (v2.08).

My main concern is how to tackle this sort of crash.

Cheers, Mark

new topic     » goto parent     » topic index » view message » categorize

8. Re: Debugging "A machine-level exception"

If some particular users are getting this error often it may be because they have DEP turned on for all programs. You can get around this by adding EUPHORIA to the list of exceptions in the Control Panel.

Shawn Pringle

new topic     » goto parent     » topic index » view message » categorize

9. Re: Debugging "A machine-level exception"

SDPringle said...

If some particular users are getting this error often it may be because they have DEP turned on for all programs. You can get around this by adding EUPHORIA to the list of exceptions in the Control Panel.

Shawn Pringle

4-6 weeks ago, I suuggested adding dep.zip, or whatever it is called, to the interpreter, but there has been no discussion on the topic that I'm aware of.

CChris

new topic     » goto parent     » topic index » view message » categorize

10. Re: Debugging "A machine-level exception"

"DEP" exception SOLVED the problem. Thanx.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu