x86 register/flag patch appled in pydb branch of ddd
"R. Bernstein" <[email protected]>
| Newsgroups | gmane.comp.debugging.ddd.general |
|---|---|
| Message-ID | <[email protected]> |
In the pydb branch of ddd, I've applied Zarko Zivanov's patches to facilitate Intel register and flag display. The changes are a little bit different than the patches provided. First, things that were not related to Intel registers and flags were not applied, and in particular X resource changes in Ddd.in.m4, such as cutCopyPasteBindings, groupIconify, displayLineNumbers, etc. While I do appreciate the feedback from user experience with regards to what better defaults should be, I don't feel qualified or authoritative to make this a global change for everyone. Here, I think Zarko should just make a diff to this file and apply it to Ddd.in.m4 (or the installed Ddd) whenever he updates his release. (And given that the patch was a verson out of date this in fact might not be all that often.) A change in Ddd.in.m4 was also made to add to the "Data window", command buttons which show the values of various Intel registers and flags. The problem with this is that assumes that one is always working on an Intel x86-like CPU, and also that one is always interested in assembly debugging. That may be true for the students in Zarko's classes, but I doubt it is true for the ddd community in general. It would be nice if ddd had a context-sensitive way to add data buttons. At present though, I don't think it does. In Zarko's patch were two themes called flags.xsl and regs.xsl, I've merged them into one file called x86.xsl (or one theme, called x86). I doubt that one will want one to use one and not the other. What this theme does is look for specific expressions like "($eflags & 1) != 0" and replaces the title of the display box with something easier to understand, like "carry" (bit). A small change I've made is to make these tests more precise. For example, whereas before the test on the title was "1) != 0", it now is "($eflags & 1) != 0". In theory there could be themes for other CPU architectures, but in practice I wonder how many CPU architectures there are out there still in use and that people debug via ddd that give names to a half or a quarter of a register (e.g. ah, cx, etc.). It is however possible that folks may want to add expressions as is done in x86.vsl for flag bits (carry, overflow). There was a patch in ddd's examine command, that wouldn't compile on older C compilers because there was a declaration after a statement in block. Also the code was specific (I think) to Intel x86 assembly where %reg gets turned into $reg, e.g %ax -> $ax. I've now made this code conditional on using gdb built for x86 architectures. In the process, I've added an internal enumeration variable which indicates type of CPU that is in effect. However, right now it's only set to Intel, or unknown. If there are other customizations for other kinds of CPUs the additional enumeration values can be added and tested for. Note: I added this as a public variable rather than a private variable with two set/get methods. is_windriver_cpu uses the latter approach. Personally, I find the extra layer of "abstraction" with the private variable not all that helpful. In fact, it just makes ddd harder to debug and doesn't really improve clarity all that much either: gdb->cpu() vs. gdb->cpu. What remains to be done is to update the documentation for how to use this. It took me a long time to figure out how to use this.