| 332 | } |
| 333 | |
| 334 | void NewFunctionDialog::createSymbol() |
| 335 | { |
| 336 | if (!parseUserInput()) |
| 337 | return; |
| 338 | |
| 339 | QString error_message; |
| 340 | m_cpu.GetSymbolGuardian().ReadWrite([&](ccc::SymbolDatabase& database) { |
| 341 | ccc::Result<ccc::SymbolSourceHandle> source = database.get_symbol_source("User-Defined"); |
| 342 | if (!source.success()) |
| 343 | { |
| 344 | error_message = tr("Cannot create symbol source."); |
| 345 | return; |
| 346 | } |
| 347 | |
| 348 | ccc::Result<ccc::Function*> function = database.functions.create_symbol(std::move(m_name), m_address, *source, nullptr); |
| 349 | if (!function.success()) |
| 350 | { |
| 351 | error_message = tr("Cannot create symbol."); |
| 352 | return; |
| 353 | } |
| 354 | |
| 355 | (*function)->set_size(m_size); |
| 356 | |
| 357 | ccc::Function* existing_function = database.functions.symbol_from_handle(m_existing_function); |
| 358 | if (existing_function) |
| 359 | existing_function->set_size(m_new_existing_function_size); |
| 360 | }); |
| 361 | |
| 362 | if (!error_message.isEmpty()) |
| 363 | AsyncDialogs::warning(g_debugger_window, tr("Cannot Create Function"), error_message); |
| 364 | } |
| 365 | |
| 366 | // ***************************************************************************** |
| 367 |
nothing calls this directly
no test coverage detected