FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

problem with source code<->disassembly association

 
Post new topic   Reply to topic     Forum Index -> cv2pdb
View previous topic :: View next topic  
Author Message
Trass3r



Joined: 29 Feb 2008
Posts: 66
Location: Germany

PostPosted: Wed Jul 28, 2010 9:13 am    Post subject: problem with source code<->disassembly association Reply with quote

Found something strange. Association of source code and disassembly in the following code fragment from http://bitbucket.org/trass3r/cl4d/wiki/Home rev13 seems to be broken. If you add another blank line before the comment it surprisingly works.
Could that be some cv2pdb issue or is it yet another dmd quirk (svn dmd + patch http://d.puremagic.com/issues/show_bug.cgi?id=4503)?

(just found it by accident, the actual problem is a weird codegen error)

Code:
      if(res != CL_SUCCESS)
         throw new CLException(res);
      
      // create CLDevice array
      return new CLDevices(deviceIDs);
   }


Code:
    97:       if(res != CL_SUCCESS)
0040B7C3 83 C4 20             add         esp,20h 
0040B7C6 85 C0                test        eax,eax 
0040B7C8 74 2D                je          opencl@platform@CLPlatform@getDevices+14Bh (40B7F7h) 
0040B7CA BE 60 3B 44 00       mov         esi,offset opencl@error@CLException@__Class (443B60h) 
0040B7CF 56                   push        esi 
0040B7D0 E8 C7 17 00 00       call        __d_newclass (40CF9Ch) 
0040B7D5 83 C4 04             add         esp,4 
0040B7D8 89 45 BC             mov         dword ptr (_TMP7),eax 
0040B7DB FF 75 A0             push        dword ptr (res) 
0040B7DE FF 35 BC 79 44 00    push        dword ptr (opencl@wrapper@__ModuleInfo+3Ch (4479BCh)) 
0040B7E4 FF 35 B8 79 44 00    push        dword ptr (opencl@wrapper@__ModuleInfo+38h (4479B8h)) 
0040B7EA 6A 00                push        0 
0040B7EC E8 E7 7E FF FF       call        opencl@error@CLException@__ctor (4036D8h) 
0040B7F1 50                   push        eax 
0040B7F2 E8 E9 1F 00 00       call        __d_throw@4 (40D7E0h) 
0040B7F7 B8 70 88 44 00       mov         eax,offset opencl@wrapper@CLObjectCollection!(typedef opencl@c@cl@cl_device_id)@CLObjectCollection@__Class (448870h) 
0040B7FC 50                   push        eax 
0040B7FD E8 9A 17 00 00       call        __d_newclass (40CF9Ch) 
0040B802 89 45 C0             mov         dword ptr (_TMP8),eax 
0040B805 FF 75 B8             push        dword ptr (ebp-48h) 
0040B808 FF 75 B4             push        dword ptr (deviceIDs) 
0040B80B E8 5C 10 00 00       call        opencl@wrapper@CLObjectCollection!(typedef opencl@c@cl@cl_device_id)@CLObjectCollection@__ctor (40C86Ch) 
0040B810 83 C4 04             add         esp,4 
   102:    }


With additional blank line:
Code:
    97:       if(res != CL_SUCCESS)
0040B7C3 83 C4 20             add         esp,20h 
...
0040B7F2 E8 E9 1F 00 00       call        __d_throw@4 (40D7E0h) 
   102:       return new CLDevices(deviceIDs);
0040B7F7 B8 70 88 44 00       mov         eax,offset opencl@wrapper@CLObjectCollection!(typedef opencl@c@cl@cl_device_id)@CLObjectCollection@__Class (448870h)
...
   103:    }
Back to top
View user's profile Send private message
sagitario



Joined: 03 Mar 2007
Posts: 292

PostPosted: Fri Jul 30, 2010 1:12 am    Post subject: Reply with quote

Hi,

I haven't checked your source, but I guess it's dmds fault. Wink I've seen lines being off by 1 inside templates. Also, mixins with line breaks cause overlapping line numbers for the mixin-code and the code after the mixin.

There is no line number info manipulation done by cv2pdb apart form taking offsets to the beginning of a continuous section of code, so it should not change behaviour by adding an empty line.

Rainer
Back to top
View user's profile Send private message
Trass3r



Joined: 29 Feb 2008
Posts: 66
Location: Germany

PostPosted: Fri Jul 30, 2010 11:00 am    Post subject: Reply with quote

Ok, so it's dmd.
Yeah, mixins are hard to debug, I think it does the whole mixed in code in a single step Sad
Back to top
View user's profile Send private message
sagitario



Joined: 03 Mar 2007
Posts: 292

PostPosted: Fri Jul 30, 2010 3:30 pm    Post subject: Reply with quote

Trass3r wrote:
Yeah, mixins are hard to debug, I think it does the whole mixed in code in a single step Sad


Actually if you have line breaks in the mixin, you can blindly step through the lines (shown at the lines following the mixin). So there is effectively multiple source code at the same line.

Some time ago, I have created a patch for dmd that would write the expanded mixins into a file and redirects debug info there. The drawback was, that error messages also showed this file, not the original source file.
Back to top
View user's profile Send private message
Trass3r



Joined: 29 Feb 2008
Posts: 66
Location: Germany

PostPosted: Mon Aug 09, 2010 7:27 am    Post subject: Reply with quote

btw, does cv2pdb work for you with the latest dmd?
I compiled the latest svn revision and ran cv2pdb -C dmd.exe but it just crashed.
Back to top
View user's profile Send private message
sagitario



Joined: 03 Mar 2007
Posts: 292

PostPosted: Tue Aug 10, 2010 7:06 am    Post subject: Reply with quote

Hi,

it's not a problem with the current dmd, but with the new cv2pdb version. I've uploaded a fix. Sorry for the inconvenience.

Rainer
Back to top
View user's profile Send private message
Trass3r



Joined: 29 Feb 2008
Posts: 66
Location: Germany

PostPosted: Tue Aug 10, 2010 8:47 am    Post subject: Reply with quote

Ok thanks, works again.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> cv2pdb All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group