| 117 | } |
| 118 | |
| 119 | void DebugSession::configInferior(ILaunchConfiguration *cfg, IExecutePlugin *iexec, const QString &) |
| 120 | { |
| 121 | // Read Configuration values |
| 122 | KConfigGroup grp = cfg->config(); |
| 123 | bool breakOnStart = grp.readEntry(KDevMI::Config::BreakOnStartEntry, false); |
| 124 | bool displayStaticMembers = grp.readEntry(Config::StaticMembersEntry, false); |
| 125 | bool asmDemangle = grp.readEntry(Config::DemangleNamesEntry, true); |
| 126 | |
| 127 | if (breakOnStart) { |
| 128 | BreakpointModel* m = ICore::self()->debugController()->breakpointModel(); |
| 129 | bool found = false; |
| 130 | const auto breakpoints = m->breakpoints(); |
| 131 | for (Breakpoint* b : breakpoints) { |
| 132 | if (b->location() == QLatin1String("main")) { |
| 133 | found = true; |
| 134 | break; |
| 135 | } |
| 136 | } |
| 137 | if (!found) { |
| 138 | m->addCodeBreakpoint(QStringLiteral("main")); |
| 139 | } |
| 140 | } |
| 141 | // Needed so that breakpoint widget has a chance to insert breakpoints. |
| 142 | // FIXME: a bit hacky, as we're really not ready for new commands. |
| 143 | setDebuggerStateOn(s_dbgBusy); |
| 144 | raiseEvent(debugger_ready); |
| 145 | |
| 146 | if (displayStaticMembers) { |
| 147 | addCommand(MI::GdbSet, QStringLiteral("print static-members on")); |
| 148 | } else { |
| 149 | addCommand(MI::GdbSet, QStringLiteral("print static-members off")); |
| 150 | } |
| 151 | |
| 152 | if (asmDemangle) { |
| 153 | addCommand(MI::GdbSet, QStringLiteral("print asm-demangle on")); |
| 154 | } else { |
| 155 | addCommand(MI::GdbSet, QStringLiteral("print asm-demangle off")); |
| 156 | } |
| 157 | |
| 158 | // Set the environment variables |
| 159 | const EnvironmentProfileList environmentProfiles(KSharedConfig::openConfig()); |
| 160 | QString envProfileName = iexec->environmentProfileName(cfg); |
| 161 | if (envProfileName.isEmpty()) { |
| 162 | qCWarning(DEBUGGERGDB) << i18n("No environment profile specified, looks like a broken " |
| 163 | "configuration, please check run configuration '%1'. " |
| 164 | "Using default environment profile.", cfg->name()); |
| 165 | envProfileName = environmentProfiles.defaultProfileName(); |
| 166 | } |
| 167 | const auto& envvars = environmentProfiles.createEnvironment(envProfileName, {}); |
| 168 | for (const auto& envvar : envvars) { |
| 169 | addCommand(GdbSet, QLatin1String("environment ") + envvar); |
| 170 | } |
| 171 | |
| 172 | qCDebug(DEBUGGERGDB) << "Per inferior configuration done"; |
| 173 | } |
| 174 | |
| 175 | bool DebugSession::execInferior(KDevelop::ILaunchConfiguration *cfg, IExecutePlugin *, const QString &executable) |
| 176 | { |
nothing calls this directly
no test coverage detected