Esempio n. 1
0
ErrorStack LogOptions::save(tinyxml2::XMLElement* element) const {
  CHECK_ERROR(insert_comment(element, "Set of options for log manager"));

  EXTERNALIZE_SAVE_ELEMENT(element, folder_path_pattern_,
    "String pattern of path of log folders in each NUMA node.\n"
    " This specifies the path of the folder to contain log file written out in each NUMA node."
    " Two special placeholders can be used; $NODE$ and $LOGGER$."
    " $NODE$ is replaced with the NUMA node number."
    " $LOGGER$ is replaced with the logger index in the node (0 to loggers_per_node_ - 1)."
    " For example,\n"
    " /log/node_$NODE$/logger_$LOGGER$ becomes /log/node_1/logger_0 on node-1 and logger-0."
    " /log/logger_$INDEX$ becomes /log/logger_1 on any node and logger-1."
    " Both are optional. You can specify a fixed path without the patterns, which means you"
    " will use the same folder for multiple loggers and nodes. Even in that case, log file"
    " names include node/logger number, so it wouldn't cause any data corruption."
    " It just makes things harder for poor sysadmins.");
  EXTERNALIZE_SAVE_ELEMENT(element, loggers_per_node_, "Number of loggers per NUMA node."
    "This value must be at least 1 (which is also default)."
    " A larger value might be able to employ more CPU power if you have succient # of cores."
    " For the best performance, the number of loggers in each NUMA node must be"
    " a submultiple of the number of cores in the node (s.t. logger assignment is balanced).");
  EXTERNALIZE_SAVE_ELEMENT(element, log_buffer_kb_, "Buffer size in KB of each worker thread");
  EXTERNALIZE_SAVE_ELEMENT(element, log_file_size_mb_, "Size in MB of files loggers write out");
  EXTERNALIZE_SAVE_ELEMENT(element, flush_at_shutdown_,
      "Whether to flush transaction logs and take savepoint when uninitialize() is called");
  CHECK_ERROR(add_child_element(element, "LogDeviceEmulationOptions",
          "[Experiments-only] Settings to emulate slower logging device", emulation_));
  return kRetOk;
}
Esempio n. 2
0
// This function receives possible keyboard shortcuts from standard OllyDbg
// windows. If it recognizes shortcut, it must process it and return 1,
// otherwise it returns 0.
extc int _export cdecl ODBG_Pluginshortcut(
	int origin,int ctrl,int alt,int shift,int key,void *item) {

		if (ctrl==0 && alt!=0 && key=='1') //Alt+1 to connect
		{
			connect();
			return 1;
		}

		//key==186==VK_OEM_1 is when the semicolon/colon is pressed down on US keyboards
		if (key==VK_OEM_1 && ctrl==0 && alt!=0 && item!=NULL) //item is required for setting a name/comment
		{
			t_dump *pd;
			pd=(t_dump *)item;

			if(shift!=0)
				insert_name(pd); //Alt+; to insert name
			else //shift==0
				insert_comment(pd); //Alt+: to insert comment

			return 1;
		}

		return 0; // Shortcut not recognized
	};
int tabtoh::convert(){
    bool err = 1;
    QString instr_mnemonic;
    QString num_of_instr_str;
    QString temp_line;
    QStringList instr_description;
    QStringList converted_instr_description;
    QStringList instr_names_list;
    int num_of_instr = 0;
    int instr_num_of_lines = 0;

    qDebug()<<"(tabtoh) Counting instructions ...";
    num_of_instr = count_instructions();
    num_of_instr_str = QString::number(num_of_instr, 10);
    qDebug()<<"(tabtoh) Instructions: "<<num_of_instr;

    qDebug()<<"(tabtoh) Extracting instructions ...";
    for(int i = 0; i < input_file.size(); i++){
        if(input_file.at(i).contains("INSTR")){
            err = 0;

            instr_mnemonic = input_file.at(i).section('\t', 1, 1);
            instr_mnemonic.prepend("&");
            instr_names_list << instr_mnemonic;

            for(int j = i; j < input_file.size(); j++){
                instr_description << input_file.at(j);
                instr_num_of_lines++;
                if(is_empty_line(input_file.at(j))){
                    break;
                }
            }

            if(instr_num_of_lines){
                converted_instr_description << parse_and_convert_instr(instr_description);
                instr_num_of_lines = 0;
                instr_description.clear();
            }
        }
    }


    insert_comment("/* Automatically generated by tabtoh */", output_file);
    insert_newline(output_file);
    insert_ifndef("ISA_H_", output_file);
    insert_include("common.h", output_file);
    insert_newline(output_file);
    insert_define("NUM_OF_INSTRUCTIONS", num_of_instr_str.toLatin1().data(), output_file);
    insert_newline(output_file);
    output_file += converted_instr_description;
    insert_newline(output_file);
    insert_array("const instruction_t*", model_name_str.toLatin1().data(), "NUM_OF_INSTRUCTIONS", instr_names_list, output_file);
    insert_endif(output_file);

    if(!err){
        write_entire_file(output_file_str, output_file);
    }

    return err;
}
Esempio n. 4
0
// This optional function receives commands from plugin menu in window of type
// origin. Argument action is menu identifier from ODBG_Pluginmenu(). If user
// activates automatically created entry in main menu, action is 0.
extc void _export cdecl ODBG_Pluginaction(int origin,int action,void *item) {
	t_dump *pd;
	if (origin==PM_MAIN) {
		switch (action) {
		case 1:
			connect();
			break;
		case 9: //About
			MessageBox(hwmain,
				""PLUGIN_NAME" plugin v"VERSION"\n"
				"Compiled on " __DATE__ "\n"
				"Copyright (C) 2005 Andrew Hintz\n"
				"http://guh.nu",
				""PLUGIN_NAME"",MB_OK|MB_ICONINFORMATION);
			break;
		default: break;
		}; }
	else if (origin==PM_DISASM) {
		pd=(t_dump *)item;
		switch (action)
		{
		case 2:
			insert_comment(pd);
			break;
		case 3:
			insert_name(pd);
			break;
		default:
			break;
		}//switch
	};//else if
};
Esempio n. 5
0
/* hanlder for the keybinding that inserts a comment */
static void
insert_comment_keybinding_handler (guint key_id)
{
  (void)key_id;
  
  insert_comment (-1);
}
ErrorStack DebuggingOptions::save(tinyxml2::XMLElement* element) const {
  CHECK_ERROR(insert_comment(element, "Set of options for debugging support.\n"
    "For ease of debugging, some of the options here has corresponding APIs to change\n"
    " at runtime. So, those options are merely initial configurations.\n"
    " enum DebugLogLevel: Defines debug logging levels\n"
    " kDebugLogInfo = 0: Usual logs\n"
    " kDebugLogWarning = 1: Warns that there are something unexpected, but not a big issue.\n"
    " kDebugLogError = 2: Raises a major issue.\n"
    " kDebugLogFatal = 3: Immediately quits the engine after this log."));

  EXTERNALIZE_SAVE_ELEMENT(element, debug_log_to_stderr_,
    "Whether to write debug logs to stderr rather than log file.\n"
    " Default is false. There is an API to change this setting at runtime.");
  EXTERNALIZE_SAVE_ENUM_ELEMENT(element, debug_log_stderr_threshold_,
    "Debug logs at or above this level will be copied to stderr.\n"
    " Default is kDebugLogInfo. There is an API to change this setting at runtime.");
  EXTERNALIZE_SAVE_ENUM_ELEMENT(element, debug_log_min_threshold_,
    "Debug logs below this level will be completely ignored.\n"
    " Default is kDebugLogInfo. There is an API to change this setting at runtime.");
  EXTERNALIZE_SAVE_ELEMENT(element, verbose_log_level_,
    "Verbose debug logs (VLOG(m)) at or less than this number will be shown.\n"
    " Default is 0. There is an API to change this setting at runtime.");
  EXTERNALIZE_SAVE_ELEMENT(element, verbose_modules_,
    "Per-module verbose level."
    " The value has to contain a comma-separated list of\n"
    " 'module name'='log level'. 'module name' is a glob pattern\n"
    " (e.g., gfs* for all modules whose name starts with 'gfs'),\n"
    " matched against the filename base (that is, name ignoring .cc/.h./-inl.h)\n"
    " Default is '/'. There is an API to change this setting at runtime.");
  EXTERNALIZE_SAVE_ELEMENT(element, debug_log_dir_,
    "Path of the folder to write debug logs.\n"
    " Default is '/tmp'. @attention We do NOT have API to change this setting at runtime.\n"
    " You must configure this as a start-up option.");
  return kRetOk;
}
Esempio n. 7
0
/*
**  do_comments ()
*/
char
do_comments()
{
    char                   menu_ans ;

    do
    {
        if (canonAns == EOS)
        {
            disp_prompt(NEW_CANON,&menu_ans,NEW_CANON_A);
        }
        else
        {
            menu_ans = canonAns;
        }

        if ((menu_ans == 'c')||(menu_ans == 'C'))
        {
            create_comment();
        }

    } while ((menu_ans == 'c')||(menu_ans == 'C'));

    insert_comment();
    return(menu_ans);
} /* end of do_comments () */
Esempio n. 8
0
/* handler for the editor's popup menu entry the plugin adds */
static void
editor_menu_acivated_handler (GtkMenuItem *menu_item,
                              PluginData  *pdata)
{
  (void)menu_item;
  
  insert_comment (pdata->editor_menu_popup_line);
}
Esempio n. 9
0
ErrorStack StorageOptions::save(tinyxml2::XMLElement* element) const {
  CHECK_ERROR(insert_comment(element, "Set of options for storage manager."));
  EXTERNALIZE_SAVE_ELEMENT(element, max_storages_,
    "Maximum number of storages in this database.");
  EXTERNALIZE_SAVE_ELEMENT(element, partitioner_data_memory_mb_,
    "Size in MB of a shared memory buffer allocated for all partitioners during log gleaning."
    "Increase this value when you have a large number of storages that have large partitioning"
    " information (eg. long keys).");
  return kRetOk;
}
Esempio n. 10
0
ErrorStack SocOptions::save(tinyxml2::XMLElement* element) const {
  CHECK_ERROR(insert_comment(element, "Set of options for SOC manager"));

  EXTERNALIZE_SAVE_ENUM_ELEMENT(element, soc_type_, "How to launch SOC engine instances.");
  EXTERNALIZE_SAVE_ELEMENT(element, shared_user_memory_size_kb_,
    "As part of the global shared memory, we reserve this size of 'user memory' that can be"
    " used for arbitrary purporses by the user to communicate between SOCs.");
  EXTERNALIZE_SAVE_ELEMENT(element, spawn_executable_pattern_,
    "String pattern of path of executables to spawn SOC engines in each NUMA node.\n"
    " The default value is empty, which means we use the binary of the master (/proc/self/exe).\n"
    " If non-empty, we use the path to launch each SOC engine.\n"
    " A placeholder '$NODE$' is replaced with the NUMA node number.\n"
    " If soc_type_ is not kChildLocalSpawned or kChildRemoteSpawned, this option is ignored.");
  EXTERNALIZE_SAVE_ELEMENT(element, spawn_ld_library_path_pattern_, "String pattern of "
    "LD_LIBRARY_PATH environment variable to spawn SOC engines in each NUMA node.\n"
    " The default value is empty, which means we don't overwrite LD_LIBRARY_PATH of this master"
    " process. To overwrite master process's LD_LIBRARY_PATH with empty value, put one space etc.");
  return kRetOk;
}
Esempio n. 11
0
ErrorStack Savepoint::save(tinyxml2::XMLElement* element) const {
  assert_epoch_values();
  CHECK_ERROR(insert_comment(element, "progress of the entire engine"));

  EXTERNALIZE_SAVE_ELEMENT(element, current_epoch_, "Current epoch of the entire engine.");
  EXTERNALIZE_SAVE_ELEMENT(element, durable_epoch_,
               "Latest epoch whose logs were all flushed to disk");
  EXTERNALIZE_SAVE_ELEMENT(element, latest_snapshot_id_, "The most recent complete snapshot.");
  EXTERNALIZE_SAVE_ELEMENT(element, latest_snapshot_epoch_,
              "The most recently snapshot-ed epoch, all logs upto this epoch is safe to delete.");
  EXTERNALIZE_SAVE_ELEMENT(element, meta_log_oldest_offset_,
               "Offset from which metadata log entries are not gleaned yet");
  EXTERNALIZE_SAVE_ELEMENT(element, meta_log_durable_offset_,
               "Offset upto which metadata log entries are fsynced");
  EXTERNALIZE_SAVE_ELEMENT(element, oldest_log_files_,
               "Ordinal of the oldest active log file in each logger");
  EXTERNALIZE_SAVE_ELEMENT(element, oldest_log_files_offset_begin_,
          "Indicates the inclusive beginning of active region in the oldest log file");
  EXTERNALIZE_SAVE_ELEMENT(element, current_log_files_,
               "Indicates the log file each logger is currently appending to");
  EXTERNALIZE_SAVE_ELEMENT(element, current_log_files_offset_durable_,
            "Indicates the exclusive end of durable region in the current log file");
  return kRetOk;
}
Esempio n. 12
0
xptr deep_copy_node(xptr left, xptr right, xptr parent, xptr node, upd_ns_map** nsupdmap, bool save_types, unsigned short depth)
{
    xptr result;
    xptr node_indir;
    schema_node_cptr scmnode;
    xmlscm_type scm_type;

    /* Rollback transaction if timeout value's been exceeded */
    CHECK_TIMER_FLAG

#ifdef SE_ENABLE_FTSEARCH
    if (!depth) init_ft_sequences(left,right,parent);
#endif
#ifdef SE_ENABLE_TRIGGERS
    if (parent == XNULL) {
        if (left != XNULL) {
            CHECKP(left);
            parent = nodeGetParent(left);
        } else {
            CHECKP(right);
            parent = nodeGetParent(right);
        }
    }

    node = apply_per_node_triggers(node, XNULL, parent, XNULL, TRIGGER_BEFORE,  TRIGGER_INSERT_EVENT);

    if (node == XNULL) {
        if (left == XNULL) { return XNULL; }
        CHECKP(left);
        return left;
    }
#endif

    node_indir = getIndirectionSafeCP(node);
    scmnode = getSchemaNode(node);

    switch (scmnode->type) {
        case element: {
            xptr result_indir;
            xmlns_ptr ns = scmnode->get_xmlns();

            if (nsupdmap != NULL && ns != NULL_XMLNS) {
                replaceNamespace(ns, *nsupdmap);
            }

            scm_type = (save_types) ? getScmType(node) : xs_untyped;
            result = insert_element(left, right, parent, scmnode->name, scm_type, ns);
            result_indir = get_last_mo_inderection();

            copy_node_content(result_indir, indirectionDereferenceCP(node_indir), XNULL, nsupdmap, save_types, depth);

            result = indirectionDereferenceCP(result_indir);
            CHECKP(result);
                      }
                      break;

        case text: {
            if (CommonTextNode(node).isEmpty()) {
                if (IS_DATA_BLOCK(node)) {
                    throw SYSTEM_EXCEPTION("BAD DATA!!!");
                } else {
                    return left;
                }
            } else {
                if (getTextFlags(node, cdata_section) > 0) {
                     cdataflag_hint = cdata_section | cdata_inherit;
                }
                result = insert_text(left, right, parent, text_source_node(node));
                cdataflag_hint = 0;
            }
                   }
                   break;

        case comment: {
            text_membuf_t buf(text_source_node(node));
            result = insert_comment(left, right, parent, buf.getCstr(), buf.getSize());
                      }
                      break;

        case pr_ins: {
            size_t tsize = PINode(node).getPITargetSize();
            text_membuf_t buf(text_source_node(node));
            result = insert_pi(left, right, parent, buf.getCstr(), tsize, buf.getCstr() + tsize + 1, buf.getSize() - tsize - 1);
        }
        break;

        case attribute: {
            xmlns_ptr ns = scmnode->get_xmlns();
            text_membuf_t buf(text_source_node(node));

            if (nsupdmap != NULL && ns != NULL_XMLNS) {
                replaceNamespace(ns, *nsupdmap);
            };

            if (depth == 0 && ns != NULL_XMLNS) {
                const xmlns_ptr new_ns = swizzle_namespace(parent, ns);
                if (new_ns != NULL_XMLNS) {
                    insert_namespace(left, right, parent, new_ns);
                    ns = new_ns;
                }
            }

            CHECKP(node);
            scm_type = (save_types) ? AttributeNode(node).getType() : xs_untypedAtomic;
            result = insert_attribute(left, right, parent, scmnode->name, scm_type, buf.getCstr(), buf.getSize(), ns);
        }
        break;

        case xml_namespace: {
            xmlns_ptr ns = NSNode(node).getNamespaceLocal();

            /* That is bad to copy default namespace alone without its node  */
            if (ns->has_prefix() || depth > 0) {
                if (nsupdmap != NULL && ns->has_prefix()) {
                    replaceNamespace(ns, *nsupdmap);
                }

                if (depth == 0) {
                    const xmlns_ptr new_ns = swizzle_namespace(parent, ns);
                    if (new_ns != NULL_XMLNS) {
                        if (nsupdmap != NULL) { (**nsupdmap)[ns] = new_ns; }
                        ns = new_ns;
                    }
                }

                result = insert_namespace(left, right, parent, ns);
            } else {
                return left;
            }
        }
        break;

        default:
            throw SYSTEM_EXCEPTION("Deep copy error: document node copied");
    }

    CHECKP(result);

#ifdef SE_ENABLE_FTSEARCH
    update_insert_sequence(result, getSchemaNode(result));
#endif

#ifdef SE_ENABLE_TRIGGERS
    if (parent==XNULL) parent= nodeGetParentIndirection(left);
    apply_per_node_triggers(result, XNULL, parent, XNULL, TRIGGER_AFTER, TRIGGER_INSERT_EVENT);
#endif

    CHECKP(result);

    return result;
}
ErrorStack RestartOptions::save(tinyxml2::XMLElement* element) const {
  CHECK_ERROR(insert_comment(element, "Set of options for restart manager"));
  return kRetOk;
}
Esempio n. 14
0
/* handler that documents current symbol */
static void
document_current_symbol_handler (GObject   *obj,
                                 gpointer   data)
{
  insert_comment (-1);
}