Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Fully implement dbgshim so it doesn't depend on LD_LIBRARY_PATH (issue #650) #1141

Merged
merged 3 commits into from
Jun 17, 2015

Conversation

mikem8361
Copy link
Member

It finds and uses the path coreclr is in to load dbi/dac.

EnumProcessModules returns an array of module base addresses and GetModuleFileNameEx
takes the base address and returns the module name string.

Fixed directory separator in dbgshim.

…e #650).

It finds and uses the path coreclr is in to load dbi/dac.

EnumProcessModules returns an array of module base addresses and GetModuleFileNameEx
takes the base address and returns the module name string.

Fixed directory separator in dbgshim.
@mikem8361
Copy link
Member Author

@Djuffin and @jkotas could you review? Thanks.

if (inode != 0)
{
bool dup = false;
for (ProcessModules *entry = listHead; entry != NULL; entry = entry->Next)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really possible to have shared library mapped to non-contiguous blocks of memory? If not, we can get rid of this loop and only check current list head.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is usually true except I did see a map like this:

7f18da0dc000-7f18da2db000 ---p 00025000 fc:00 1048889 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f18da2db000-7f18da2df000 r--p 00024000 fc:00 1048889 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f18da2df000-7f18da2e0000 rw-p 00028000 fc:00 1048889 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f18da2e0000-7f18da304000 r-xp 00000000 fc:00 1050720 /lib/x86_64-linux-gnu/ld-2.21.so
7f18da4e8000-7f18da4eb000 rw-p 00000000 00:00 0
7f18da4fa000-7f18da501000 r--s 00000000 fc:00 15999053 /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7f18da501000-7f18da503000 rw-p 00000000 00:00 0
7f18da503000-7f18da504000 r--p 00023000 fc:00 1050720 /lib/x86_64-linux-gnu/ld-2.21.so
7f18da504000-7f18da505000 rw-p 00024000 fc:00 1050720 /lib/x86_64-linux-gnu/ld-2.21.so
7f18da505000-7f18da506000 rw-p 00000000 00:00 0

And I guess I was just being thorough.

mikem

From: Eugene Zemtsov [mailto:notifications@github.com]
Sent: Monday, June 15, 2015 3:10 PM
To: dotnet/coreclr
Cc: Mike McLaughlin
Subject: Re: [coreclr] Fully implement dbgshim so it doesn't depend on LD_LIBRARY_PATH (issue #650) (#1141)

In src/pal/src/thread/process.cpphttps://github.com//pull/1141#discussion_r32472765:

  • int count = 0;
  • ssize_t read;
  • // Reading maps file line by line
  • while ((read = getline(&line, &lineLen, mapsFile)) != -1)
  • {
  •    void *startAddress, *endAddress, *offset;
    
  •    int devHi, devLo, inode;
    
  •    char moduleName[PATH_MAX];
    
  •    if (sscanf(line, "%p-%p %*[-rwxsp] %p %x:%x %d %s\n", &startAddress, &endAddress, &offset, &devHi, &devLo, &inode, moduleName) == 7)
    
  •    {
    
  •        if (inode != 0)
    
  •        {
    
  •            bool dup = false;
    
  •            for (ProcessModules *entry = listHead; entry != NULL; entry = entry->Next)
    

Is it really possible to have shared library mapped to non-contiguous blocks of memory? If not, we get rid of this loop and only check current list head.


Reply to this email directly or view it on GitHubhttps://github.com//pull/1141/files#r32472765.

@Djuffin
Copy link

Djuffin commented Jun 15, 2015

сс @noahfalk

@noahfalk
Copy link
Member

lgtm, albeit I didn't scrutinize too closely. Let me know if you think more scrutiny is worthwhile ; )

mikem8361 added a commit that referenced this pull request Jun 17, 2015
Fully implement dbgshim so it doesn't depend on LD_LIBRARY_PATH (issue #650)
@mikem8361 mikem8361 merged commit 5f62317 into dotnet:master Jun 17, 2015
@mikem8361 mikem8361 deleted the dbgshim branch June 17, 2015 00:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
5 participants