• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisãod2242e347a25dc15fbf7286975e3baba143deea9 (tree)
Hora2015-10-30 02:54:20
AutorPedro Alves <palves@redh...>
CommiterPedro Alves

Mensagem de Log

mdebugread.c: Address class -> address class index

This fixes this error in C++ mode:

/home/pedro/gdb/mygit/cxx-convertion/src/gdb/mdebugread.c:654:11: error: invalid conversion from ‘int’ to ‘address_class’ [-fpermissive]
theclass = mdebug_register_index;


The "theclass" local is of type enum address_class, however, what it
really holds is an address class index. Class index values by design
match the address class values up until LOC_FINAL_VALUE, but extend
beyond that, so it's not really right to store an address class index
in an enum address_class.

The fix is really the same making the 'theclass' local be of type int,
but while we're at it, we get rid of the goto, and thus the local
becomes the 'aclass_index' parameter in the new add_data_symbol
function.

gdb/ChangeLog:
2015-10-29 Pedro Alves <palves@redhat.com>

* mdebugread.c (add_data_symbol): New function, factored out from
...
(parse_symbol): ... here. Delete 'theclass' local.

Mudança Sumário

Diff

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
1+2015-10-29 Pedro Alves <palves@redhat.com>
2+
3+ * mdebugread.c (add_data_symbol): New function, factored out from
4+ ...
5+ (parse_symbol): ... here. Delete 'theclass' local.
6+
17 2015-10-29 Simon Marchi <simon.marchi@polymtl.ca>
28
39 * jit.c (jit_target_read_impl): Add cast.
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -567,6 +567,26 @@ static const struct symbol_register_ops mdebug_register_funcs = {
567567 static int mdebug_register_index;
568568 static int mdebug_regparm_index;
569569
570+/* Common code for symbols describing data. */
571+
572+static void
573+add_data_symbol (SYMR *sh, union aux_ext *ax, int bigend,
574+ struct symbol *s, int aclass_index, struct block *b,
575+ struct objfile *objfile, char *name)
576+{
577+ SYMBOL_DOMAIN (s) = VAR_DOMAIN;
578+ SYMBOL_ACLASS_INDEX (s) = aclass_index;
579+ add_symbol (s, top_stack->cur_st, b);
580+
581+ /* Type could be missing if file is compiled without debugging info. */
582+ if (SC_IS_UNDEF (sh->sc)
583+ || sh->sc == scNil || sh->index == indexNil)
584+ SYMBOL_TYPE (s) = objfile_type (objfile)->nodebug_data_symbol;
585+ else
586+ SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);
587+ /* Value of a data symbol is its memory address. */
588+}
589+
570590 static int
571591 parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
572592 struct section_offsets *section_offsets, struct objfile *objfile)
@@ -581,7 +601,6 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
581601 struct type *t;
582602 struct field *f;
583603 int count = 1;
584- enum address_class theclass;
585604 TIR tir;
586605 long svalue = sh->value;
587606 int bitsize;
@@ -622,15 +641,14 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
622641 break;
623642
624643 case stGlobal: /* External symbol, goes into global block. */
625- theclass = LOC_STATIC;
626644 b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (top_stack->cur_st),
627645 GLOBAL_BLOCK);
628646 s = new_symbol (name);
629647 SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;
630- goto data;
648+ add_data_symbol (sh, ax, bigend, s, LOC_STATIC, b, objfile, name);
649+ break;
631650
632651 case stStatic: /* Static data, goes into current block. */
633- theclass = LOC_STATIC;
634652 b = top_stack->cur_block;
635653 s = new_symbol (name);
636654 if (SC_IS_COMMON (sh->sc))
@@ -644,29 +662,19 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
644662 }
645663 else
646664 SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;
647- goto data;
665+ add_data_symbol (sh, ax, bigend, s, LOC_STATIC, b, objfile, name);
666+ break;
648667
649668 case stLocal: /* Local variable, goes into current block. */
650669 b = top_stack->cur_block;
651670 s = new_symbol (name);
652671 SYMBOL_VALUE (s) = svalue;
653672 if (sh->sc == scRegister)
654- theclass = mdebug_register_index;
655- else
656- theclass = LOC_LOCAL;
657-
658- data: /* Common code for symbols describing data. */
659- SYMBOL_DOMAIN (s) = VAR_DOMAIN;
660- SYMBOL_ACLASS_INDEX (s) = theclass;
661- add_symbol (s, top_stack->cur_st, b);
662-
663- /* Type could be missing if file is compiled without debugging info. */
664- if (SC_IS_UNDEF (sh->sc)
665- || sh->sc == scNil || sh->index == indexNil)
666- SYMBOL_TYPE (s) = objfile_type (objfile)->nodebug_data_symbol;
673+ add_data_symbol (sh, ax, bigend, s, mdebug_register_index,
674+ b, objfile, name);
667675 else
668- SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);
669- /* Value of a data symbol is its memory address. */
676+ add_data_symbol (sh, ax, bigend, s, LOC_LOCAL,
677+ b, objfile, name);
670678 break;
671679
672680 case stParam: /* Arg to procedure, goes into current