mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: clang related fixes, find in files now trims long lines when putting them to output display array to avoid slowdowns
git-svn-id: svn://ultimatepp.org/upp/trunk@14115 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
39355c2646
commit
5941dfdae3
7 changed files with 123 additions and 100 deletions
|
|
@ -265,10 +265,9 @@ void Ide::BuildAndExtDebugFile()
|
|||
}
|
||||
|
||||
One<Debugger> GdbCreate(One<Host>&& host, const String& exefile, const String& cmdline, bool console);
|
||||
One<Debugger> Gdb_MI2Create(One<Host>&& host, const String& exefile, const String& cmdline, bool console);
|
||||
|
||||
#ifdef PLATFORM_WIN32
|
||||
One<Debugger> CdbCreate(One<Host>&& host, const String& exefile, const String& cmdline);
|
||||
One<Debugger> PdbCreate(One<Host>&& host, const String& exefile, const String& cmdline);
|
||||
One<Debugger> PdbCreate(One<Host>&& host, const String& exefile, const String& cmdline, bool clang);
|
||||
#endif
|
||||
|
||||
void Ide::BuildAndDebug(bool runto)
|
||||
|
|
@ -297,7 +296,7 @@ void Ide::BuildAndDebug(bool runto)
|
|||
|
||||
#ifdef PLATFORM_WIN32
|
||||
if(findarg(builder, "GCC", "CLANG") < 0 || bm.Get("DEBUG_OPTIONS", String()).Find("-gcodeview") >= 0) // llvm-mingw can generate pdb symbolic info
|
||||
debugger = PdbCreate(pick(host), target, runarg);
|
||||
debugger = PdbCreate(pick(host), target, runarg, builder == "CLANG");
|
||||
else
|
||||
#endif
|
||||
debugger = GdbCreate(pick(host), target, runarg, console);
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ INITBLOCK
|
|||
RegisterGlobalConfig(CONFIGNAME);
|
||||
}
|
||||
|
||||
bool Pdb::Create(One<Host> local, const String& exefile, const String& cmdline)
|
||||
bool Pdb::Create(One<Host> local, const String& exefile, const String& cmdline, bool clang_)
|
||||
{
|
||||
STARTUPINFO si;
|
||||
ZeroMemory(&si, sizeof(STARTUPINFO));
|
||||
|
|
@ -154,6 +154,8 @@ bool Pdb::Create(One<Host> local, const String& exefile, const String& cmdline)
|
|||
cl << exefile;
|
||||
if(!IsNull(cmdline))
|
||||
cl << ' ' << cmdline;
|
||||
|
||||
clang = clang_;
|
||||
|
||||
Buffer<char> cmd(cl.GetLength() + 1);
|
||||
memcpy(cmd, cl, cl.GetLength() + 1);
|
||||
|
|
@ -438,10 +440,10 @@ Pdb::~Pdb()
|
|||
Stop();
|
||||
}
|
||||
|
||||
One<Debugger> PdbCreate(One<Host>&& host, const String& exefile, const String& cmdline)
|
||||
One<Debugger> PdbCreate(One<Host>&& host, const String& exefile, const String& cmdline, bool clang)
|
||||
{
|
||||
One<Debugger> dbg;
|
||||
if(!dbg.Create<Pdb>().Create(pick(host), exefile, cmdline))
|
||||
if(!dbg.Create<Pdb>().Create(pick(host), exefile, cmdline, clang))
|
||||
dbg.Clear();
|
||||
return dbg;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ struct Pdb : Debugger, ParentCtrl {
|
|||
HWND hWnd;
|
||||
VectorMap<adr_t, byte> bp_set; // breakpoints active for single RunToException
|
||||
|
||||
bool clang; // we are in clang toolchain
|
||||
bool win64; // debugee is 64-bit, always false in 32-bit exe
|
||||
|
||||
Context context;
|
||||
|
|
@ -386,6 +387,7 @@ struct Pdb : Debugger, ParentCtrl {
|
|||
Val GetAttr(Pdb::Val record, const String& id);
|
||||
int64 GetInt64Attr(Pdb::Val v, const char *a);
|
||||
int GetIntAttr(Pdb::Val v, const char *a) { return (int)GetInt64Attr(v, a); }
|
||||
byte GetByteAttr(Pdb::Val v, const char *a) { return (byte)GetInt64Attr(v, a); }
|
||||
Val At(Pdb::Val val, int i);
|
||||
Val At(Pdb::Val record, const char *id, int i);
|
||||
int IntAt(Pdb::Val record, const char *id, int i);
|
||||
|
|
@ -497,7 +499,7 @@ struct Pdb : Debugger, ParentCtrl {
|
|||
|
||||
void Tab();
|
||||
|
||||
bool Create(One<Host> host, const String& exefile, const String& cmdline);
|
||||
bool Create(One<Host> local, const String& exefile, const String& cmdline, bool clang_);
|
||||
|
||||
void SerializeSession(Stream& s);
|
||||
|
||||
|
|
|
|||
|
|
@ -268,14 +268,32 @@ void Pdb::PrettyStdVector(Pdb::Val val, const Vector<String>& tparam, int64 from
|
|||
|
||||
void Pdb::PrettyStdString(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
Val q = GetAttr(GetAttr(val, "_Mypair"), "_Myval2");
|
||||
adr_t a;
|
||||
int size;
|
||||
bool w = tparam[0] == "wchar_t";
|
||||
int size = GetIntAttr(q, "_Mysize");
|
||||
int res = GetIntAttr(q, "_Myres");
|
||||
if(HasAttr(val, "__r_")) { // CLANG variant
|
||||
Val r = GetAttr(GetAttr(val, "__r_"), "__value_");
|
||||
Val s = GetAttr(r, "__s");
|
||||
size = GetByteAttr(s, "__size_");
|
||||
if(size & 1) {
|
||||
Val l = GetAttr(r, "__l");
|
||||
size = GetIntAttr(l, "__size_");
|
||||
a = DeRef(GetAttr(l, "__data_")).address;
|
||||
}
|
||||
else {
|
||||
size = size >> 1;
|
||||
a = s.address + 1 + w;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Val q = GetAttr(GetAttr(val, "_Mypair"), "_Myval2");
|
||||
int size = GetIntAttr(q, "_Mysize");
|
||||
int res = GetIntAttr(q, "_Myres");
|
||||
a = GetAttr(GetAttr(q, "_Bx"), "_Buf").address;
|
||||
if(res >= (w ? 8 : 16))
|
||||
a = PeekPtr(a);
|
||||
}
|
||||
p.data_count = size;
|
||||
adr_t a = GetAttr(GetAttr(q, "_Bx"), "_Buf").address;
|
||||
if(res >= (w ? 8 : 16))
|
||||
a = PeekPtr(a);
|
||||
p.data_type << (w ? "short int" : "char");
|
||||
int sz = w + 1;
|
||||
for(int i = 0; i < count; i++)
|
||||
|
|
|
|||
|
|
@ -226,6 +226,10 @@ BOOL CALLBACK Pdb::EnumLocals(PSYMBOL_INFO pSym, ULONG SymbolSize, PVOID UserCon
|
|||
DDUMP(pSym->Flags & IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE);
|
||||
DDUMP(pSym->Register == CV_ALLREG_VFRAME);
|
||||
DDUMP(pSym->Register);
|
||||
DDUMP(pSym->Scope);
|
||||
DDUMP(pSym->Value);
|
||||
DDUMP(pSym->ModBase);
|
||||
DDUMPHEX((adr_t)pSym->Address);
|
||||
#endif
|
||||
|
||||
bool param = pSym->Flags & IMAGEHLP_SYMBOL_INFO_PARAMETER;
|
||||
|
|
@ -241,7 +245,7 @@ BOOL CALLBACK Pdb::EnumLocals(PSYMBOL_INFO pSym, ULONG SymbolSize, PVOID UserCon
|
|||
v.address += c.pdb->GetCpuRegister(*c.context, CV_AMD64_RBP);
|
||||
else
|
||||
#endif
|
||||
v.address += (adr_t)c.pdb->GetCpuRegister(*c.context, CV_REG_EBP);
|
||||
v.address += (adr_t)c.pdb->GetCpuRegister(*c.context, CV_REG_EBP) - 4 * c.pdb->clang; // Workaround for supposed clang/win32 issue
|
||||
}
|
||||
else
|
||||
v.address += (adr_t)c.pdb->GetCpuRegister(*c.context, pSym->Register);
|
||||
|
|
@ -250,7 +254,6 @@ BOOL CALLBACK Pdb::EnumLocals(PSYMBOL_INFO pSym, ULONG SymbolSize, PVOID UserCon
|
|||
if(pSym->Flags & IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE)
|
||||
v.address += c.frame;
|
||||
|
||||
LLOG("LOCAL " << pSym->Name << ": " << Format64Hex(v.address));
|
||||
c.pdb->TypeVal(v, pSym->TypeIndex, (adr_t)pSym->ModBase);
|
||||
if(param && v.udt && v.ref == 0 && c.pdb->win64) { // dbghelp.dll incorrectly does not report pointer for (copied) value struct params
|
||||
v.ref++;
|
||||
|
|
@ -258,6 +261,7 @@ BOOL CALLBACK Pdb::EnumLocals(PSYMBOL_INFO pSym, ULONG SymbolSize, PVOID UserCon
|
|||
}
|
||||
v.reported_size = pSym->Size;
|
||||
v.context = c.context;
|
||||
LLOG("LOCAL " << c.pdb->GetType(v.type).name << " " << pSym->Name << ": " << Format64Hex(v.address));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -275,6 +279,7 @@ void Pdb::GetLocals(Frame& frame, Context& context, VectorMap<String, Pdb::Val>&
|
|||
SymEnumSymbols(hProcess, 0, 0, &EnumLocals, &c);
|
||||
param = pick(c.param);
|
||||
local = pick(c.local);
|
||||
LLOG("===========================");
|
||||
}
|
||||
|
||||
BOOL CALLBACK Pdb::EnumGlobals(PSYMBOL_INFO pSym, ULONG SymbolSize, PVOID UserContext)
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ void Ide::AddFoundFile(const String& fn, int ln, const String& line, int pos, in
|
|||
f.len = count;
|
||||
f.kind = 0;
|
||||
f.message = "\1" + EditorSyntax::GetSyntaxForFilename(fn) + "\1" +
|
||||
AsString(pos) + "\1" + AsString(count) + "\1" + line;
|
||||
AsString(pos) + "\1" + AsString(count) + "\1" + (line.GetCount() > 300 ? line.Mid(0, 300) : line);
|
||||
FFound().Add(fn, ln, f.message, RawToValue(f));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,13 +121,88 @@ void bmSet(VectorMap<String, String>& bm, const char *id, const String& val)
|
|||
|
||||
void InstantSetup()
|
||||
{
|
||||
DirFinder df;
|
||||
|
||||
bool dirty = false;
|
||||
String default_method;
|
||||
|
||||
bool dirty = false;
|
||||
String bin = GetExeDirFile("bin");
|
||||
|
||||
if(DirectoryExists(bin + "/clang")) // hopefully deprecated, but keep it for now
|
||||
for(int x64 = 0; x64 < 2; x64++) {
|
||||
String method = x64 ? "CLANGx64" : "CLANG";
|
||||
#ifdef INSTANT_TESTING
|
||||
method << "Test";
|
||||
#endif
|
||||
VectorMap<String, String> bm = GetMethodVars(method);
|
||||
|
||||
Vector<String> bins = Split(bm.Get("PATH", ""), ';');
|
||||
Vector<String> incs = Split(bm.Get("INCLUDE", ""), ';');
|
||||
Vector<String> libs = Split(bm.Get("LIB", ""), ';');
|
||||
#ifdef INSTANT_TESTING
|
||||
if(CheckDirs(bins, 3) && CheckDirs(incs, 2) && CheckDirs(libs, 2)) {
|
||||
if(!x64)
|
||||
default_method = Nvl(default_method, method);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
bmSet(bm, "BUILDER", "CLANG");
|
||||
bmSet(bm, "COMPILER", x64 ? "" : "i686-w64-mingw32-c++");
|
||||
bmSet(bm, "COMMON_OPTIONS", "");
|
||||
bmSet(bm, "COMMON_CPP_OPTIONS", "");
|
||||
bmSet(bm, "COMMON_C_OPTIONS", "");
|
||||
bmSet(bm, "COMMON_LINK", "");
|
||||
bmSet(bm, "COMMON_FLAGS", "");
|
||||
bmSet(bm, "DEBUG_INFO", "2");
|
||||
bmSet(bm, "DEBUG_BLITZ", "1");
|
||||
bmSet(bm, "DEBUG_LINKMODE", "0");
|
||||
bmSet(bm, "DEBUG_OPTIONS", "-O0 -g -gcodeview -fno-limit-debug-info");
|
||||
bmSet(bm, "DEBUG_FLAGS", "");
|
||||
bmSet(bm, "DEBUG_LINK", "-Wl,-pdb= -Wl,--stack,20000000");
|
||||
bmSet(bm, "RELEASE_BLITZ", "");
|
||||
bmSet(bm, "RELEASE_LINKMODE", "0");
|
||||
bmSet(bm, "RELEASE_OPTIONS", "-O3 ");
|
||||
bmSet(bm, "RELEASE_FLAGS", "");
|
||||
bmSet(bm, "RELEASE_LINK", "-Wl,--stack,20000000");
|
||||
bmSet(bm, "DEBUGGER", "gdb");
|
||||
bmSet(bm, "ALLOW_PRECOMPILED_HEADERS", "1");
|
||||
bmSet(bm, "DISABLE_BLITZ", "");
|
||||
|
||||
// bmSet(bm, "LINKMODE_LOCK", "0");
|
||||
|
||||
String clang = bin + "/clang";
|
||||
|
||||
bins.At(0) = clang + "/bin";
|
||||
bins.At(1) = clang + (x64 ? "/x86_64-w64-mingw32/bin" : "/i686-w64-mingw32/bin");
|
||||
bins.At(2) = bin + (x64 ? "/openssl/bin64" : "/openssl/bin32");
|
||||
bins.At(3) = GetExeDirFile(x64 ? "bin/SDL2/lib/x64" : "bin/SDL2/lib/x86");
|
||||
bins.At(4) = GetExeDirFile(x64 ? "bin/pgsql/x64/bin" : "bin/pgsql/x86/bin");
|
||||
bins.At(5) = GetExeDirFile(x64 ? "bin/mysql/lib64" : "bin/mysql/lib32");
|
||||
|
||||
incs.At(0) = clang + "/include";
|
||||
incs.At(1) = bin + "/openssl/include";
|
||||
incs.At(2) = GetExeDirFile("bin/SDL2/include");
|
||||
incs.At(3) = GetExeDirFile(x64 ? "bin/pgsql/x64/include" : "bin/pgsql/x86/include");
|
||||
incs.At(4) = GetExeDirFile(x64 ? "bin/mysql/include" : "bin/mysql/include");
|
||||
|
||||
libs.At(0) = clang + "/lib";
|
||||
libs.At(1) = bin + (x64 ? "/openssl/lib64" : "/openssl/lib32");;
|
||||
libs.At(2) = GetExeDirFile(x64 ? "bin/SDL2/lib/x64" : "bin/SDL2/lib/x86");
|
||||
libs.At(3) = GetExeDirFile(x64 ? "bin/pgsql/x64/lib" : "bin/pgsql/x86/lib");
|
||||
libs.At(4) = GetExeDirFile(x64 ? "bin/mysql/lib64" : "bin/mysql/lib32");
|
||||
|
||||
bm.GetAdd("PATH") = Join(bins, ";");
|
||||
bm.GetAdd("INCLUDE") = Join(incs, ";");
|
||||
bm.GetAdd("LIB") = Join(libs, ";");
|
||||
|
||||
SaveVarFile(ConfigFile(method + ".bm"), bm);
|
||||
dirty = true;
|
||||
|
||||
if(x64)
|
||||
default_method = Nvl(default_method, method);
|
||||
}
|
||||
|
||||
enum { VS_2015, VS_2017, BT_2017, VS_2019, BT_2019 };
|
||||
DirFinder df;
|
||||
|
||||
for(int version = VS_2015; version <= BT_2019; version++)
|
||||
for(int x64 = 0; x64 < 2; x64++) {
|
||||
|
|
@ -155,8 +230,8 @@ void InstantSetup()
|
|||
Vector<String> libs = Split(bm.Get("LIB", ""), ';');
|
||||
#ifdef INSTANT_TESTING
|
||||
if(CheckDirs(bins, 2) && CheckDirs(incs, 4) && CheckDirs(libs, 3)) {
|
||||
if(!x64)
|
||||
default_method = x86method;
|
||||
if(x64)
|
||||
default_method = Nvl(default_method, x86method);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
|
@ -303,84 +378,6 @@ void InstantSetup()
|
|||
}
|
||||
}
|
||||
|
||||
String bin = GetExeDirFile("bin");
|
||||
|
||||
if(DirectoryExists(bin + "/clang")) // hopefully deprecated, but keep it for now
|
||||
for(int x64 = 0; x64 < 2; x64++) {
|
||||
String method = x64 ? "CLANGx64" : "CLANG";
|
||||
#ifdef INSTANT_TESTING
|
||||
method << "Test";
|
||||
#endif
|
||||
VectorMap<String, String> bm = GetMethodVars(method);
|
||||
|
||||
Vector<String> bins = Split(bm.Get("PATH", ""), ';');
|
||||
Vector<String> incs = Split(bm.Get("INCLUDE", ""), ';');
|
||||
Vector<String> libs = Split(bm.Get("LIB", ""), ';');
|
||||
#ifdef INSTANT_TESTING
|
||||
if(CheckDirs(bins, 3) && CheckDirs(incs, 2) && CheckDirs(libs, 2)) {
|
||||
if(!x64)
|
||||
default_method = Nvl(default_method, method);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
bmSet(bm, "BUILDER", "CLANG");
|
||||
bmSet(bm, "COMPILER", x64 ? "" : "i686-w64-mingw32-c++");
|
||||
bmSet(bm, "COMMON_OPTIONS", "");
|
||||
bmSet(bm, "COMMON_CPP_OPTIONS", "");
|
||||
bmSet(bm, "COMMON_C_OPTIONS", "");
|
||||
bmSet(bm, "COMMON_LINK", "");
|
||||
bmSet(bm, "COMMON_FLAGS", "");
|
||||
bmSet(bm, "DEBUG_INFO", "2");
|
||||
bmSet(bm, "DEBUG_BLITZ", "1");
|
||||
bmSet(bm, "DEBUG_LINKMODE", "0");
|
||||
bmSet(bm, "DEBUG_OPTIONS", "-O0 -g -gcodeview");
|
||||
bmSet(bm, "DEBUG_FLAGS", "");
|
||||
bmSet(bm, "DEBUG_LINK", "-Wl,-pdb= -Wl,--stack,20000000");
|
||||
bmSet(bm, "RELEASE_BLITZ", "");
|
||||
bmSet(bm, "RELEASE_LINKMODE", "0");
|
||||
bmSet(bm, "RELEASE_OPTIONS", "-O3 ");
|
||||
bmSet(bm, "RELEASE_FLAGS", "");
|
||||
bmSet(bm, "RELEASE_LINK", "-Wl,--stack,20000000");
|
||||
bmSet(bm, "DEBUGGER", "gdb");
|
||||
bmSet(bm, "ALLOW_PRECOMPILED_HEADERS", "1");
|
||||
bmSet(bm, "DISABLE_BLITZ", "");
|
||||
|
||||
// bmSet(bm, "LINKMODE_LOCK", "0");
|
||||
|
||||
String clang = bin + "/clang";
|
||||
|
||||
bins.At(0) = clang + "/bin";
|
||||
bins.At(1) = clang + (x64 ? "/x86_64-w64-mingw32/bin" : "/i686-w64-mingw32/bin");
|
||||
bins.At(2) = bin + (x64 ? "/openssl/bin64" : "/openssl/bin32");
|
||||
bins.At(3) = GetExeDirFile(x64 ? "bin/SDL2/lib/x64" : "bin/SDL2/lib/x86");
|
||||
bins.At(4) = GetExeDirFile(x64 ? "bin/pgsql/x64/bin" : "bin/pgsql/x86/bin");
|
||||
bins.At(5) = GetExeDirFile(x64 ? "bin/mysql/lib64" : "bin/mysql/lib32");
|
||||
|
||||
incs.At(0) = clang + "/include";
|
||||
incs.At(1) = bin + "/openssl/include";
|
||||
incs.At(2) = GetExeDirFile("bin/SDL2/include");
|
||||
incs.At(3) = GetExeDirFile(x64 ? "bin/pgsql/x64/include" : "bin/pgsql/x86/include");
|
||||
incs.At(4) = GetExeDirFile(x64 ? "bin/mysql/include" : "bin/mysql/include");
|
||||
|
||||
libs.At(0) = clang + "/lib";
|
||||
libs.At(1) = bin + (x64 ? "/openssl/lib64" : "/openssl/lib32");;
|
||||
libs.At(2) = GetExeDirFile(x64 ? "bin/SDL2/lib/x64" : "bin/SDL2/lib/x86");
|
||||
libs.At(3) = GetExeDirFile(x64 ? "bin/pgsql/x64/lib" : "bin/pgsql/x86/lib");
|
||||
libs.At(4) = GetExeDirFile(x64 ? "bin/mysql/lib64" : "bin/mysql/lib32");
|
||||
|
||||
bm.GetAdd("PATH") = Join(bins, ";");
|
||||
bm.GetAdd("INCLUDE") = Join(incs, ";");
|
||||
bm.GetAdd("LIB") = Join(libs, ";");
|
||||
|
||||
SaveVarFile(ConfigFile(method + ".bm"), bm);
|
||||
dirty = true;
|
||||
|
||||
if(!x64)
|
||||
default_method = Nvl(default_method, method);
|
||||
}
|
||||
|
||||
|
||||
if(DirectoryExists(bin + "/mingw64")) // hopefully deprecated, but keep it for now
|
||||
for(int x64 = 0; x64 < 2; x64++) {
|
||||
String method = x64 ? "MINGWx64" : "MINGW";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue