digitalmars.D.learn - DLang/Wiki/'Hello World'/Run Code/Disassembly
- DLearner (2/2) Oct 21 2016 Code ran with expected output, but Disassembly seemed to go in a
- cym13 (38/40) Oct 21 2016 What makes you think that? It's hard to tell if you don't give
- DLearner (3/7) Oct 21 2016 I pressed the 'Run' button and got the 'Hello World'.
- Daniel Kozak via Digitalmars-d-learn (5/14) Oct 21 2016 Okey so some page does not work correctly, and you think this? Wow :D
- cym13 (16/25) Oct 21 2016 That's a problem about the debugger/disassembler that you use,
- cym13 (2/19) Oct 21 2016 Apologies, I didn't understand that you put all that in the title.
Code ran with expected output, but Disassembly seemed to go in a loop?
Oct 21 2016
On Friday, 21 October 2016 at 08:58:50 UTC, DLearner wrote:Code ran with expected output, but Disassembly seemed to go in a loop?What makes you think that? It's hard to tell if you don't give any information. Let's do that! I'll use only naive flags and all and use radare2 to disassemble the main D function which is _Dmain (the entry point has to launch the runtime etc... we aren't very interested in that): $ cat >test.d <<EOF import std.stdio; void main() { writeln("Hello World!"); } EOF $ dmd test.d $ ./test Hello World! $ r2 -q -c "afr; pdf sym._Dmain" test ┌ (fcn) sym._Dmain 24 │ sym._Dmain (); │ ; CALL XREF from 0x08078258 (sym.main) │ ; DATA XREF from 0x0807825b (sym.main) │ 0x08077e70 55 push ebp │ 0x08077e71 8bec mov ebp, esp │ 0x08077e73 b9d02b0a08 mov ecx, str.Hello_World_; "Hello World!" 0x80a2bd0 │ 0x08077e78 b80c000000 mov eax, 0xc │ 0x08077e7d 51 push ecx │ 0x08077e7e 50 push eax │ 0x08077e7f e804000000 call sym._D3std5stdio16__T7writelnTAyaZ7writelnFNfAyaZv │ 0x08077e84 31c0 xor eax, eax │ 0x08077e86 5d pop ebp └ 0x08077e87 c3 ret No loop. Not even a jump. I'm in x86 so arguments are simply pushed on the stack. No brainer.
Oct 21 2016
On Friday, 21 October 2016 at 09:07:35 UTC, cym13 wrote:On Friday, 21 October 2016 at 08:58:50 UTC, DLearner wrote:I pressed the 'Run' button and got the 'Hello World'. I pressed the 'Disassembly' button and got...nothing.[...]What makes you think that? It's hard to tell if you don't give any information.
Oct 21 2016
Dne 21.10.2016 v 21:03 DLearner via Digitalmars-d-learn napsal(a):On Friday, 21 October 2016 at 09:07:35 UTC, cym13 wrote:Okey so some page does not work correctly, and you think this? Wow :D you should try one of these this pages http://asm.dlang.org http://d.godbolt.orgOn Friday, 21 October 2016 at 08:58:50 UTC, DLearner wrote:I pressed the 'Run' button and got the 'Hello World'. I pressed the 'Disassembly' button and got...nothing.[...]What makes you think that? It's hard to tell if you don't give any information.
Oct 21 2016
On Friday, 21 October 2016 at 19:03:30 UTC, DLearner wrote:On Friday, 21 October 2016 at 09:07:35 UTC, cym13 wrote:That's a problem about the debugger/disassembler that you use, not about D. We can't do anything else to help as you give no information. See my post: - I gave the exact source code - I gave the compiler that I used with all its flags - I explained what tool I used to analyse it, what I was analysing exactly and how - At each step I gave the exact output of the tools with potential errors This means this is reproducible. Anybody can try it at home and check for himself that it works. There is *no way* to fix a bug that we can't reproduce, and there is *no way* to reproduce it unless we have all the informations stated above.On Friday, 21 October 2016 at 08:58:50 UTC, DLearner wrote:I pressed the 'Run' button and got the 'Hello World'. I pressed the 'Disassembly' button and got...nothing.[...]What makes you think that? It's hard to tell if you don't give any information.
Oct 21 2016
On Friday, 21 October 2016 at 19:27:59 UTC, cym13 wrote:On Friday, 21 October 2016 at 19:03:30 UTC, DLearner wrote:Apologies, I didn't understand that you put all that in the title.[...]That's a problem about the debugger/disassembler that you use, not about D. We can't do anything else to help as you give no information. See my post: - I gave the exact source code - I gave the compiler that I used with all its flags - I explained what tool I used to analyse it, what I was analysing exactly and how - At each step I gave the exact output of the tools with potential errors This means this is reproducible. Anybody can try it at home and check for himself that it works. There is *no way* to fix a bug that we can't reproduce, and there is *no way* to reproduce it unless we have all the informations stated above.
Oct 21 2016