digitalmars.D.learn - object.error: Privileged Instruction
- simendsjo (19/19) Sep 22 2012 What does the message in the subject mean?
- Maxim Fomin (8/8) Sep 22 2012 Privilege instruction is an assembly instruction which can be
- Jonathan M Davis (5/14) Sep 22 2012 It's a normal assertion without -release. With -release, it's a halt
- Don Clugston (6/20) Sep 26 2012 I implemented the code runtime code that does it, at least on Windows.
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (3/4) Sep 22 2012 Yep, Dvorak keyboard rules! ;)
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 } }
Sep 22 2012
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.
Sep 22 2012
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
Sep 22 2012
On 22/09/12 21:49, Jonathan M Davis wrote:On Saturday, September 22, 2012 21:19:27 Maxim Fomin wrote: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.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
Sep 26 2012
On 09/22/2012 11:33 AM, simendsjo wrote:assert(false, "aoeu"); // with message, object.error: PrivilegedYep, Dvorak keyboard rules! ;) Ali
Sep 22 2012