397 _print_raw(0),
398 _cur_insn(NULL),
399 _bytes_per_line(0),
400 _pre_decode_alignment(0),
401 _post_decode_alignment(0),
402 _print_file_name(false),
403 _print_help(false),
404 _helpPrinted(false) {
405
406 assert(start < end, "Range must have a positive size, [" PTR_FORMAT ".." PTR_FORMAT ").", p2i(start), p2i(end));
407 memset(_option_buf, 0, sizeof(_option_buf));
408 process_options(_output);
409 }
410
411 void decode_env::process_options(outputStream* ost) {
412 // by default, output pc but not bytes:
413 _print_help = false;
414 _bytes_per_line = Disassembler::pd_instruction_alignment();
415 _print_file_name = true;
416
417 if (_optionsParsed) return; // parse only once
418
419 // parse the global option string:
420 collect_options(Disassembler::pd_cpu_opts());
421 collect_options(PrintAssemblyOptions);
422
423 if (strstr(options(), "print-raw")) {
424 _print_raw = (strstr(options(), "xml") ? 2 : 1);
425 }
426
427 if (strstr(options(), "help")) {
428 _print_help = true;
429 }
430 if (strstr(options(), "align-instr")) {
431 AbstractDisassembler::toggle_align_instr();
432 }
433 if (strstr(options(), "show-pc")) {
434 AbstractDisassembler::toggle_show_pc();
435 }
436 if (strstr(options(), "show-offset")) {
437 AbstractDisassembler::toggle_show_offset();
438 }
439 if (strstr(options(), "show-bytes")) {
440 AbstractDisassembler::toggle_show_bytes();
441 }
|
397 _print_raw(0),
398 _cur_insn(NULL),
399 _bytes_per_line(0),
400 _pre_decode_alignment(0),
401 _post_decode_alignment(0),
402 _print_file_name(false),
403 _print_help(false),
404 _helpPrinted(false) {
405
406 assert(start < end, "Range must have a positive size, [" PTR_FORMAT ".." PTR_FORMAT ").", p2i(start), p2i(end));
407 memset(_option_buf, 0, sizeof(_option_buf));
408 process_options(_output);
409 }
410
411 void decode_env::process_options(outputStream* ost) {
412 // by default, output pc but not bytes:
413 _print_help = false;
414 _bytes_per_line = Disassembler::pd_instruction_alignment();
415 _print_file_name = true;
416
417 // parse the global option string
418 if ((options() == NULL) || (strlen(options()) == 0)) {
419 // We need to fill the options buffer for each newly created
420 // decode_env instance. The hsdis_* library looks for options
421 // in that buffer.
422 collect_options(Disassembler::pd_cpu_opts());
423 collect_options(PrintAssemblyOptions);
424 }
425
426 if (_optionsParsed) return; // parse only once
427
428 if (strstr(options(), "print-raw")) {
429 _print_raw = (strstr(options(), "xml") ? 2 : 1);
430 }
431
432 if (strstr(options(), "help")) {
433 _print_help = true;
434 }
435 if (strstr(options(), "align-instr")) {
436 AbstractDisassembler::toggle_align_instr();
437 }
438 if (strstr(options(), "show-pc")) {
439 AbstractDisassembler::toggle_show_pc();
440 }
441 if (strstr(options(), "show-offset")) {
442 AbstractDisassembler::toggle_show_offset();
443 }
444 if (strstr(options(), "show-bytes")) {
445 AbstractDisassembler::toggle_show_bytes();
446 }
|