Project

General

Profile

Bug #4948

mdb does not print enums correctly in a pipeline

Added by Alex Reece over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
mdb - modular debugger
Start date:
2014-06-30
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

When printing enums in a pipeline, mdb gets type errors. For example:

    > ::walk spa | ::walk metaslab | ::print metaslab_t ms_loaded
    ms_loaded = 0 (0)
    ms_loaded = 0 (0)
    ms_loaded = 0x1 (B_TRUE)
    ms_loaded = 0 (0)
    ms_loaded = 0 (0)

Works as expected, but

    > ::walk spa | ::walk metaslab | ::print metaslab_t ms_loaded | ::eval
'.=D'
    mdb: failed to print type: Type is not an integer or float
    mdb: failed to print type: Type is not an integer or float
    mdb: failed to print type: Type is not an integer or float
    mdb: failed to print type: Type is not an integer or float
    mdb: failed to print type: Type is not an integer or float

Produces the above type errors.

cmd_print is correctly acknowledging the DCMD_PIPE_OUT flag and calling a
special pipe_print function to output the result. The following excerpt from
pipe_print (in mdb_print.c) is troubling though:

    case CTF_K_INTEGER:
    case CTF_K_ENUM:
        if (mdb_ctf_type_encoding(base, &e) != 0) {
            mdb_printf("could not get type encoding\\n");
            return (-1);
        }

The issue is that mdb_ctf_type_encoding is a wrapper for ctf_type_encoding,
which is only valid to call for INTEGER or FLOATs.

#1

Updated by Electric Monk over 6 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit e9f82d69e04fa1b2246da55152ef2e746284078d

commit  e9f82d69e04fa1b2246da55152ef2e746284078d
Author: Alex Reece <alex@delphix.com>
Date:   2014-07-02T23:20:41.000Z

    4948 mdb does not print enums correctly in a pipeline
    Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
    Reviewed by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed by: Marcel Telka <marcel@telka.sk>
    Approved by: Dan McDonald <danmcd@omniti.com>

Also available in: Atom PDF