[Crash-utility] fix gdb_get_datatype cannot handle integer type

Dave Anderson anderson at redhat.com
Wed Mar 6 14:04:10 UTC 2013



----- Original Message -----
> Hi Dave,
> 
> Current when pass integer type to gdb_get_datatype in crash, it would return
> req->typecode=0 and req->length=0.
> 
> As it only allow TYPE_CODE_ENUM to be passed. here is a patch for fixing it.
> Do you think it could be merged?

That's the OP_VAR_VALUE section -- what is the command that you're using that
ends up passing an integer type to the function?  And what problem does it
cause?

Dave


> 
> +--- gdb-7.3.1/gdb/symtab.c
> ++++ gdb-7.3.1/gdb/symtab.c
> +@@ -5064,14 +5064,13 @@ gdb_get_datatype(struct gnu_request *req)
> +               if (gdb_CRASHDEBUG(2))
> +                       console("expr->elts[0].opcode:
> OP_VAR_VALUE\n");
> +               type = expr->elts[2].symbol->type;
> +-              if (TYPE_CODE(type) == TYPE_CODE_ENUM) {
> +-                      req->typecode = TYPE_CODE(type);
> +-                      req->value =
> SYMBOL_VALUE(expr->elts[2].symbol);
> +-                      req->tagname = TYPE_TAG_NAME(type);
> +-                      if (!req->tagname) {
> +-                              val = evaluate_type(expr);
> +-                              eval_enum(value_type(val), req);
> +-                      }
> ++              req->typecode = TYPE_CODE(type);
> ++              req->length = TYPE_LENGTH(type);
> ++              req->value = SYMBOL_VALUE(expr->elts[2].symbol);
> ++              req->tagname = TYPE_TAG_NAME(type);
> ++              if (!req->tagname) {
> ++                      val = evaluate_type(expr);
> ++                      eval_enum(value_type(val), req);
> +               }
> +               break;
> +
> 
> Thanks,
> Lei
> 




More information about the Crash-utility mailing list