Problem with GlobalVariable getDebugInfo

Hi, everyone. I am having trouble trying to obtain the debug information for a GlobalVariable. I am running the following code:

SmallVector<DIGlobalVariableExpression *, 1> dbgs;
gv->getDebugInfo(dbgs);

This leads to the following error:

realloc(): invalid pointerStack dump:
0. Program arguments: opt -load build/Misc.so -Misc tests/objs/3.opt -o bcs/tmp.bc

  1. Running pass ‘Misc Pass’ on module ‘tests/objs/3.opt’.
    LLVMSymbolizer: error reading file: No such file or directory

I should mention that this exact code was working perfectly on a different machine. Unfortunately, it is no longer possible for me to access that machine.
The LLVM version for both machines is 7.0. The glibc version (if relevant) is 2.27 on the current machine (on which it fails). I do not the glibc version for the previous machine.

Any help would be appreciated.