- fix: Crash when debug project that has nasm files.
- enhancement: Generate debug info for nasm files in Linux/MacOS. - enhancement: Compile/Run/Debug GAS source files. - enhancement: Compile/Debug GAS source files in project.
This commit is contained in:
parent
a6cae34a99
commit
0e3441e604
5
NEWS.md
5
NEWS.md
|
@ -5,6 +5,11 @@ Red Panda C++ Version 2.12
|
|||
- enhancement: Code folding for #if/#endif
|
||||
- enhancement: When folding "if", don't fold "else";
|
||||
- fix: Confirm if recompile, when start to debug and project files has modifications.
|
||||
- fix: Crash when debug project that has nasm files.
|
||||
- enhancement: Generate debug info for nasm files in Linux/MacOS.
|
||||
- enhancement: Compile/Run/Debug GAS source files.
|
||||
- enhancement: Compile/Debug GAS source files in project.
|
||||
|
||||
|
||||
Red Panda C++ Version 2.11
|
||||
|
||||
|
|
|
@ -98,6 +98,13 @@ bool FileCompiler::prepareForCompile()
|
|||
mArguments += getCharsetArgument(mEncoding, fileType, mOnlyCheckSyntax);
|
||||
QString strFileType;
|
||||
switch(fileType) {
|
||||
case FileType::GAS:
|
||||
mArguments += getCCompileArguments(mOnlyCheckSyntax);
|
||||
mArguments += getCIncludeArguments();
|
||||
mArguments += getProjectIncludeArguments();
|
||||
strFileType = "GNU Assembler";
|
||||
mCompiler = compilerSet()->CCompiler();
|
||||
break;
|
||||
case FileType::CSource:
|
||||
mArguments += getCCompileArguments(mOnlyCheckSyntax);
|
||||
mArguments += getCIncludeArguments();
|
||||
|
|
|
@ -160,7 +160,7 @@ void ProjectCompiler::writeMakeDefines(QFile &file)
|
|||
continue;
|
||||
|
||||
if (fileType == FileType::CSource || fileType == FileType::CppSource
|
||||
|| fileType == FileType::ASM) {
|
||||
|| fileType == FileType::ASM || fileType==FileType::GAS) {
|
||||
if (!mProject->options().objectOutput.isEmpty()) {
|
||||
// ofile = C:\MyProgram\obj\main.o
|
||||
QString fullObjFile = includeTrailingPathDelimiter(mProject->options().objectOutput)
|
||||
|
@ -285,21 +285,28 @@ void ProjectCompiler::writeMakeDefines(QFile &file)
|
|||
#ifdef Q_OS_WIN
|
||||
writeln(file,"WINDRESFLAGS = " + mProject->options().resourceCmd);
|
||||
#endif
|
||||
if (compilerSet()->canAssemble()) {
|
||||
QString asmFlags;
|
||||
#ifdef Q_OS_WIN
|
||||
if (compilerSet()->canAssemble() &&
|
||||
Settings::CompilerSets::isTarget64Bit(compilerSet()->target())) {
|
||||
if (Settings::CompilerSets::isTarget64Bit(compilerSet()->target())) {
|
||||
if (mProject->getCompileOption(CC_CMD_OPT_POINTER_SIZE)=="32")
|
||||
writeln(file,"ASMFLAGS = -f win32 " + mProject->options().assemblerArgs);
|
||||
asmFlags = "-f win32 " + mProject->options().assemblerArgs;
|
||||
else
|
||||
writeln(file,"ASMFLAGS = -f win64 " + mProject->options().assemblerArgs);
|
||||
asmFlags = "-f win64 " + mProject->options().assemblerArgs;
|
||||
} else {
|
||||
writeln(file,"ASMFLAGS = -f win32 " + mProject->options().assemblerArgs);
|
||||
asmFlags = "-f win32 " + mProject->options().assemblerArgs;
|
||||
}
|
||||
#elif defined(Q_OS_LINUX)
|
||||
writeln(file,"ASMFLAGS = -f elf64");
|
||||
asmFlags = "-f elf64";
|
||||
if (mProject->getCompileOption(CC_CMD_OPT_DEBUG_INFO) == COMPILER_OPTION_ON)
|
||||
asmFlags += " -g ";
|
||||
#elif defined(Q_OS_MACOS)
|
||||
writeln(file,"ASMFLAGS = -f macho64");
|
||||
asmFlags = "-f macho64";
|
||||
if (mProject->getCompileOption(CC_CMD_OPT_DEBUG_INFO) == COMPILER_OPTION_ON)
|
||||
asmFlags += " -g ";
|
||||
#endif
|
||||
writeln(file,"ASMFLAGS = " + asmFlags);
|
||||
}
|
||||
|
||||
// This needs to be put in before the clean command.
|
||||
if (mProject->options().type == ProjectType::DynamicLib) {
|
||||
|
@ -379,7 +386,8 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file)
|
|||
FileType fileType = getFileType(unit->fileName());
|
||||
// Only process source files
|
||||
if (fileType!=FileType::CSource && fileType!=FileType::CppSource
|
||||
&& fileType!=FileType::ASM)
|
||||
&& fileType!=FileType::ASM
|
||||
&& fileType!=FileType::GAS)
|
||||
continue;
|
||||
|
||||
QString shortFileName = extractRelativePath(mProject->makeFileName(),unit->fileName());
|
||||
|
@ -494,6 +502,10 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file)
|
|||
else
|
||||
writeln(file, "\t$(CC) -c " + genMakePath1(shortFileName) + " -o " + objFileName2 + " $(CFLAGS) " + encodingStr);
|
||||
}
|
||||
} else if (fileType==FileType::GAS) {
|
||||
if (!mOnlyCheckSyntax) {
|
||||
writeln(file, "\t$(CC) -c " + genMakePath1(shortFileName) + " -o " + objFileName2 + " $(CFLAGS) " + encodingStr);
|
||||
}
|
||||
} else if (fileType==FileType::ASM) {
|
||||
if (!mOnlyCheckSyntax) {
|
||||
writeln(file, "\t$(ASM) " + genMakePath1(shortFileName) + " -o " + objFileName2 + " $(ASMFLAGS) ");
|
||||
|
|
|
@ -3859,6 +3859,8 @@ QString Editor::getParserHint(const QStringList& expression,const QString &/*s*/
|
|||
|
||||
void Editor::showDebugHint(const QString &s, int line)
|
||||
{
|
||||
if (!mParser)
|
||||
return;
|
||||
PStatement statement = mParser->findStatementOf(mFilename,s,line);
|
||||
if (statement) {
|
||||
if (statement->kind != StatementKind::skVariable
|
||||
|
|
|
@ -696,6 +696,9 @@ void MainWindow::updateCompileActions(const Editor *e)
|
|||
canGenerateAssembly = true;
|
||||
canCompile = true;
|
||||
canRun = true;
|
||||
} else if (fileType == FileType::GAS) {
|
||||
canCompile = true;
|
||||
canRun = true;
|
||||
}
|
||||
} else {
|
||||
forProject = (mProject!=nullptr);
|
||||
|
|
|
@ -951,6 +951,7 @@ bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate, b
|
|||
|
||||
FileType fileType=getFileType(unit->fileName());
|
||||
if (fileType==FileType::ASM
|
||||
|| fileType==FileType::GAS
|
||||
|| isCFile(unit->fileName()) || isHFile(unit->fileName())) {
|
||||
Editor * editor = mEditorList->newEditor(
|
||||
unit->fileName(),
|
||||
|
@ -1277,6 +1278,11 @@ PProjectUnit Project::internalAddUnit(const QString &inFileName, PProjectModelNo
|
|||
|
||||
// Determine compilation flags
|
||||
switch(getFileType(inFileName)) {
|
||||
case FileType::GAS:
|
||||
newUnit->setCompile(true);
|
||||
newUnit->setCompileCpp(false);
|
||||
newUnit->setLink(true);
|
||||
break;
|
||||
case FileType::ASM:
|
||||
newUnit->setCompile(true);
|
||||
newUnit->setCompileCpp(false);
|
||||
|
|
|
@ -84,6 +84,7 @@
|
|||
#define RES_EXT "res"
|
||||
#define H_EXT "h"
|
||||
#define OBJ_EXT "o"
|
||||
#define LST_EXT "lst"
|
||||
#define DEF_EXT "def"
|
||||
#define LIB_EXT "a"
|
||||
#define GCH_EXT "gch"
|
||||
|
|
|
@ -86,6 +86,9 @@ FileType getFileType(const QString &filename)
|
|||
if (filename.endsWith(".asm",PATH_SENSITIVITY)) {
|
||||
return FileType::ASM;
|
||||
}
|
||||
if (filename.endsWith(".s",PATH_SENSITIVITY)) {
|
||||
return FileType::GAS;
|
||||
}
|
||||
if (filename.endsWith(".dev",PATH_SENSITIVITY)) {
|
||||
return FileType::Project;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ using PSimpleIni = std::shared_ptr<SimpleIni>;
|
|||
|
||||
enum class FileType{
|
||||
ASM, // asm source file (.asm)
|
||||
GAS, // GNU assembler source file (.s)
|
||||
CSource, // c source file (.c)
|
||||
CppSource, // c++ source file (.cpp)
|
||||
CHeader, // c header (.h)
|
||||
|
|
|
@ -1611,12 +1611,6 @@ int QSynEdit::calcIndentSpaces(int line, const QString& lineText, bool addIndent
|
|||
QString trimmedLineText = lineText.trimmed();
|
||||
mSyntaxer->setState(rangePreceeding);
|
||||
mSyntaxer->setLine(trimmedLineText,line-1);
|
||||
int statePrePre;
|
||||
if (startLine>1) {
|
||||
statePrePre = mDocument->getSyntaxState(startLine-2).state;
|
||||
} else {
|
||||
statePrePre = 0;
|
||||
}
|
||||
SyntaxState rangeAfterFirstToken = mSyntaxer->getState();
|
||||
QString firstToken = mSyntaxer->getToken();
|
||||
PTokenAttribute attr = mSyntaxer->getTokenAttribute();
|
||||
|
|
|
@ -98,7 +98,7 @@ QSet<QString> Syntaxer::keywords() const
|
|||
return QSet<QString>();
|
||||
}
|
||||
|
||||
QString Syntaxer::foldString(QString startLine)
|
||||
QString Syntaxer::foldString(QString /*startLine*/)
|
||||
{
|
||||
return " ... }";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue