3F / DllExport

.NET DllExport with .NET Core support (aka 3F/DllExport aka DllExport.bat)
MIT License
962 stars 133 forks source link

Mismatching .PDB-Files? #23

Open OzzyL opened 7 years ago

OzzyL commented 7 years ago

I seem to be unable to load debug information for projects where I use DLLExport v1.5.1. I have seen the issue in both Visual Studio 2013 and 2015.

image

image

I can load .pdb-files when using DLLExport 1.4.0, without problem. I have also uploaded a simple sample project, which reproduce the issue.

DLLExportPdbTest.zip

3F commented 7 years ago

"Binary was not built with debug information"

try with original coreclr:

<DllExportOurILAsm>false</DllExportOurILAsm>

later I will look this in details when I'll have new time for this :( Source code of my ILAsm here if you need: https://github.com/3F/coreclr

By the way, for your sample, feel free with Conari engine:

using(var l = new ConariL("DllExportLib.dll")) {
    l.DLR.Hello(); // that's all what you need in your `DLLExportPdbTest`
}

full control via lambda expressions like this:

bool v = l.bind<Func<int, string, bool>>("set")(-1, "Hello from Conari !");
// DLR:
bool v = l.DLR.set(-1, "Hello from Conari !");

etc.

OzzyL commented 7 years ago

It works when I set accordingly: <DllExportOurILAsm>false</DllExportOurILAsm>

image

First time I hear of Conair. Holy.. This changes everything!

3F commented 7 years ago

First time I hear of Conair. Holy.. This changes everything!

just follow me. You can also find other "Holy.." products from me :)

It works when I set accordingly:

well yes, this problem only from ILAsm. Thanks for reply.

3F commented 7 years ago

just details for this issue

I don't see .line directives if used our ILDasm:

il_line_directive

dis.cpp:943:

strcpy_s(szVarPrefix,MAX_PREFIX_SIZE,"V0");
if(g_pSymReader)  // <<<<<<<<<<<<<<<< should be NULL /ISymUnmanagedReader*
{
    g_pSymReader->GetMethod(FuncToken,&pSymMethod);
    ...
        pSymMethod->GetSequencePoints(ulLines,&actualCount, offsets,docs,lines,columns, endlines, endcolumns);
        for(ULONG i = 0; i < ulLines; i++)
        {
            pLCD->Line = lines[i];
            pLCD->Column = columns[i];
            pLCD->LineEnd = endlines[i];
            pLCD->ColumnEnd = endcolumns[i];
            pLCD->PC = offsets[i];
            pLCD->FileToken = (ULONG_PTR)docs[i];
            ulActualLines++;
            pLCD++;
        }
        ...

dasm.cpp:599:

#ifndef FEATURE_CORECLR
...
hr = CoCreateInstance(CLSID_CorSymBinder_SxS, NULL,
                              CLSCTX_INPROC_SERVER,
                              IID_ISymUnmanagedBinder,
                              (void**)&binder);

if (SUCCEEDED(hr))
{
    hr = binder->GetReaderForFile(g_pPubImport,
                                  wzInputFileName,
                                  NULL,
                                  &g_pSymReader);
...

and this is a hard limitation, I mean simply def with CMake:

project(ildasm)
add_definitions(-DFEATURE_CORECLR)

+ilasm, +mscorpe

I found this commit:

SHA-1: 1b6658714821566dd9ab78dcf1fe96fcb0f8772a
...
This ILDASM now depends on CoreCLR targeting cross-platform and thus 
I dropped some features like GUI/PDB -- default output is console.

well yes...

the .line directives is unavailable at all + source code already is not valid (dead code) without FEATURE_CORECLR for latest changes. Thus we need to restore this: to implement support for latest changes or try with older rev.

Any pull requests are welcome, or wait of my time /after the rain on thursday :) -_-

nabnaj commented 4 years ago

Hello, I was testing a [C# DLL] in C++ with mixed debugging mode , VS community 2019. Why does it reload the same DLL, then it just unloads its symbols? image

image

Thanks

3F commented 4 years ago

@nabnaj, What about a thrown exception in KernelBase? :) Seems like this is it. Look for related issues on the current tracker, or please open a new one.