[Crash-utility] fix gdb_get_datatype cannot handle integer type

Lei Wen adrian.wenl at gmail.com
Wed Mar 6 06:00:29 UTC 2013


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?

+--- 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