WinDBG/Exts/CodeAnalyzer/gdbplus/gdb-1824/src/gdb/gdb_dep.c
/* print structure layout in windbg "dt" style */
print structure layout in windbg "dt" style
print structure layout in windbg " dt " style
void print_type_layout (char* exp)
{
	struct type *type = get_real_type_from_exp (exp);
    if (type)
    {
    	int indirect = 0;
    	int is_ptr = 0;
    	if (TYPE_CODE (type) == TYPE_CODE_PTR)
    		is_ptr = 1;
		printf_filtered (_("type="));
		type_print (type, "", gdb_stdout, -1);
		printf_filtered (_("  size=%d\n"), type->length);
		while (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_CODE (type) == TYPE_CODE_REF)
		{
			type = TYPE_TARGET_TYPE(type);
			indirect++;
		}
		if (TYPE_CODE(type) == TYPE_CODE_STRUCT || TYPE_CODE(type) == TYPE_CODE_UNION)
		{
			printf_filtered (_("{\n"));
			print_type_members (type, 1);
			printf_filtered (_("}"));
			while (indirect > 0)
			{
				if (is_ptr)
					printf_filtered (_("*"));
				else
					printf_filtered (_("&"));
				indirect--;
			}
			printf_filtered (_(";\n"));
		}
    }
}
void print_type_layout ( char * exp ) { struct type * type = get_real_type_from_exp ( exp ) ; if ( type ) { int indirect = 0 ; int is_ptr = 0 ; if ( TYPE_CODE ( type ) == TYPE_CODE_PTR ) is_ptr = 1 ; printf_filtered ( _ ( " " ) ) ; type_print ( type , " " , gdb_stdout , -1 ) ; printf_filtered ( _ ( " \n " ) , type -> length ) ; while ( TYPE_CODE ( type ) == TYPE_CODE_PTR || TYPE_CODE ( type ) == TYPE_CODE_REF ) { type = TYPE_TARGET_TYPE ( type ) ; indirect ++ ; } if ( TYPE_CODE ( type ) == TYPE_CODE_STRUCT || TYPE_CODE ( type ) == TYPE_CODE_UNION ) { printf_filtered ( _ ( " \n " ) ) ; print_type_members ( type , 1 ) ; printf_filtered ( _ ( " " ) ) ; while ( indirect > 0 ) { if ( is_ptr ) printf_filtered ( _ ( " " ) ) ; else printf_filtered ( _ ( " " ) ) ; indirect -- ; } printf_filtered ( _ ( " \n " ) ) ; } } }
print structure layout in windbg "dt" style
print structure layout in windbg " dt " style
/* print type name */ // if the type is pointer/reference, print the base type