Re: [RFC PATCH] struct: Fix handing of percpu symbols

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




----- Original Message -----
> Hi Dave,
> 
> 
> When a percpu symbol is of type pointer, the 'struct' command does
> not generate the expected output. For example:
> 

Aaron,

I haven't gotten a chance to actually test this patch, but this part bothers me:

+               if (typename && (ptype = (LASTCHAR(typename) == '*')))
+                       open_tmpfile2();
                for (c = 0; c < kt->cpus; c++) {
                        ulong cpuaddr;

@@ -6227,9 +6266,25 @@ cmd_datatype_common(ulong flags)
                                continue;
                        }

+                       if (ptype) {
+                               snprintf(buf, sizeof buf, "p *(%s*) 0x%lx",
+                                       typename, cpuaddr);
+                               gdb_pass_through(buf, pc->tmpfile2, GNU_RETURN_ON_ERROR);
+
+                               rewind(pc->tmpfile2);
+                               fgets(buf, BUFSIZE, pc->tmpfile2);
+                               parse_line(buf, argv);
+                               cpuaddr = htol(argv[3], FAULT_ON_ERROR, NULL);
+                               rewind(pc->tmpfile2);
+                               tmpfp = pc->tmpfile2;
+                               pc->tmpfile2 = NULL;
+                       }
                        fprintf(fp, "%lx\n", cpuaddr);
+
                        do_datatype_addr(dm, cpuaddr , count,
                                         flags, memberlist, argc_members);
+                       if (ptype)
+                               set_tmpfile2(tmpfp);
                }
        } else
                do_datatype_addr(dm, addr, count, flags,
@@ -6237,6 +6292,9 @@ cmd_datatype_common(ulong flags)

        restore_current_radix(restore_radix);

+       if (ptype)
+               close_tmpfile2();
+

Can't you accomplish the same thing without kludging the tmpfile2
facility such that it's being used simultaneously above and then later 
via do_datatype_addr()?

I may be missing something, but it seems like you just need it to calculate
cpuaddr each time through the loop, and then you're done with it.  But then
you rewind() it, store it, and keep tmpfp open across the do_datatype_addr()
call?  What am I missing?

Dave

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility



[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux