| Thread overview | |||||||
|---|---|---|---|---|---|---|---|
|
September 22, 2012 object.error: Privileged Instruction | ||||
|---|---|---|---|---|
| ||||
What does the message in the subject mean?
Here's a testcase (tested on dmd 2.060 on win7 32-bit):
import core.exception;
import core.runtime; // comment out this, and no stacktrace is printed
void myAssertHandler(string file, size_t line, string msg = null) { }
static this() {
setAssertHandler(&myAssertHandler);
f();
}
version(unittest) {
void f() {
//assert(false); // without message, object.error: Breakpoint
assert(false, "aoeu"); // with message, object.error: Privileged Instruction
}
}
| ||||
September 22, 2012 Re: object.error: Privileged Instruction | ||||
|---|---|---|---|---|
| ||||
Posted in reply to simendsjo | Privilege instruction is an assembly instruction which can be executed only at a certain executive process context, typically os kernel. AFAIK assert(false) was claimed to be implemented by dmd as a halt instruction, which is privileged one. However, compiled code shows that dmd generates int 3 instruction for assert(false) statement and 61_6F_65_75 which is binary representation of "aoeu" for assert(false, "aoeu") statement and the latter is interpreted as privileged i/o instruction. | |||
September 22, 2012 Re: object.error: Privileged Instruction | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Maxim Fomin | On Saturday, September 22, 2012 21:19:27 Maxim Fomin wrote:
> Privilege instruction is an assembly instruction which can be executed only at a certain executive process context, typically os kernel. AFAIK assert(false) was claimed to be implemented by dmd as a halt instruction, which is privileged one.
>
> However, compiled code shows that dmd generates int 3 instruction for assert(false) statement and 61_6F_65_75 which is binary representation of "aoeu" for assert(false, "aoeu") statement and the latter is interpreted as privileged i/o instruction.
It's a normal assertion without -release. With -release, it's a halt instruction on Linux but IIRC it's something slightly different (albeit similar) on Windows, though it might be halt there too.
- Jonathan M Davis
| |||
September 22, 2012 Re: object.error: Privileged Instruction | ||||
|---|---|---|---|---|
| ||||
Posted in reply to simendsjo | On 09/22/2012 11:33 AM, simendsjo wrote: > assert(false, "aoeu"); // with message, object.error: Privileged Yep, Dvorak keyboard rules! ;) Ali | |||
September 26, 2012 Re: object.error: Privileged Instruction | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On 22/09/12 21:49, Jonathan M Davis wrote:
> On Saturday, September 22, 2012 21:19:27 Maxim Fomin wrote:
>> Privilege instruction is an assembly instruction which can be
>> executed only at a certain executive process context, typically
>> os kernel. AFAIK assert(false) was claimed to be implemented by
>> dmd as a halt instruction, which is privileged one.
>>
>> However, compiled code shows that dmd generates int 3 instruction
>> for assert(false) statement and 61_6F_65_75 which is binary
>> representation of "aoeu" for assert(false, "aoeu") statement and
>> the latter is interpreted as privileged i/o instruction.
>
> It's a normal assertion without -release. With -release, it's a halt
> instruction on Linux but IIRC it's something slightly different (albeit
> similar) on Windows, though it might be halt there too.
>
> - Jonathan M Davis
>
I implemented the code runtime code that does it, at least on Windows. You get much better diagnostics on Windows.
IMHO it is a Linux misfeature, they conflate a couple of unrelated hardware exceptions together into one signal, making it hard to identify which it was.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply