Differences between revisions 44 and 46 (spanning 2 versions)
Revision 44 as of 2011-10-27 14:48:55
Size: 7307
Editor: TomTromey
Comment: add some concrete cleanup ideas
Revision 46 as of 2011-11-11 18:34:13
Size: 7647
Editor: TomTromey
Comment: bool cleanup
Deletions are marked like this. Additions are marked like this.
Line 24: Line 24:
   * Change gdb to use {{{bool}}} where appropriate. You could grab {{{stdbool.h}}} from gnulib and make incremental changes across gdb.
Line 31: Line 32:
   * The {{{complaint}}} system is not thread-safe. It would be nice to change the API so that the global state was more obviously manipulated so that the functions could be used from other threads.

This is a list of project ideas for GDB - potential improvements, new features, et cetera. If you have a large project to add to this list, you may want to put just a brief description and a link to a new Wiki page.

Fix known bugs

  • There are lots of bugs in the bugzilla database. Everyone is welcome to look at them, reproduce them, comment on them, fix them, et cetera!

  • There are testsuite failures running 'make check' on many systems. Each one of these failures should be investigated, and either fixed or the testsuite adjusted.
  • There are many XFAIL (expected failure) and KFAIL (known failure) markers in the testsuite. Some of the XFAIL markers are for environmental problems, for instance known bugs in some compiler versions. But others of them are for bugs in GDB that no one has looked at in a long time. There should be fewer!


  • The run command should support pipes, i.e., set up inferior input to come from another program. This has been asked a number of times on the GDB IRC channel.


  • The GDB internals are filled with multiple ways of doing the same tasks, all subtly different. Pick a module of GDB, look at the interfaces it exports, and think about which ones should really exist.
  • Many internal functions have been deprecated but not removed. Some of the deprecated functions do not have obvious replacements; either replacements should be created or the deprecation markers removed. Others do have obvious replacements, and only await someone to update the old uses. Just search for "deprecated" or "DEPRECATED" in the sources, and you'll find lots of instances of this problem. This is a good introductory project for someone who wants to learn about the GDB internals.
  • Enable building with -Wunused. Right now, this option is not enabled because the current sources would need to be cleaned up a bit. In particular, there are probably some unused entities left, as well as some function parameters that are unused. Enabling this option would require someone motivated to fix all the warnings that it would generate. Alternatively, we could use -Wunused minus the unused parameter warnings, which would already be a nice improvement but at a more reduced cleanup cost.
  • Enable building with -Wshadow. Right now, this option is not enabled because the sources as they are trigger too many errors. Enabling this option would require someone motivated to fix all the warnings that it would generate.
  • GDB has several functions to read strings from the inferior. They should be consolidated in one function, or at most two. These are the existing string-reading functions: target_read_string, valprint.c:read_string, read_memory_string. This list is not exhaustive, perhaps there are more functions.

  • Remove global variables. A number of GDB modules use global variables, but not for any good reason. These should be removed and turned into parameters to the functions in the module. Examples include the globals in parser-defs.h and those in buildsym.h. (Not all globals are worth removing -- anything associated with the user's state in the CLI is probably a true global.)

  • There is a lot of duplication of linux target support in gdb and gdbserver. IWBN to consolidate this.
  • Remove macros from gdbarch.sh. There are still a lot of gdbarch-specific functions implemented as macros in gdbarch.sh. These should be replaced by their appropriate "gdbarch_"-functions. This transition is currently ongoing.
  • Here are some specific internal cleanups that are worth doing:
    • Change gdb to use bool where appropriate. You could grab stdbool.h from gnulib and make incremental changes across gdb.

    • Remove the globals from parser-defs.h; instead, they should be in an object that is passed to the parsers.

    • Remove the globals from buildsym.h and change the debug readers to create and destroy objects instead.

    • Right now valops.c and value.c can refer to current_language. This should be a parameter instead.

    • Expression creation involves two different variants of a rather weird data structure. Change this to a single data structure, with ordinary fields and subclassing.
    • Expression evaluation is currently implemented via a large recursive function. This means it cannot be paused in the middle and restarted -- important for async inferior function calls. So, change expression evaluation to use an explicit stack and to be pausable.
    • Printing has both the val_print and value_print APIs. The former is increasingly difficult to maintain; it should be removed and just a single struct value-based API should remain.

    • wrap_here does not take an output stream argument. It should.

    • The complaint system is not thread-safe. It would be nice to change the API so that the global state was more obviously manipulated so that the functions could be used from other threads.


  • A full "struct symbol" is created for enumerators. If we could avoid that, it might save a lot of space. Enumerators are a large chunk of the symbol table in some programs, because they appear in header files (e.g. from glibc, from BFD).
  • Split struct objfile into two parts so that it can be reused across inferiors. The basic out line of this idea is here.


  • GDB issues an error if you try to set a hardware watchpoint on an unreadable address (for instance, an address which has not been malloc'd yet). It disables watchpoints when addresses become unreadable. Hardware permitting, it would be great to be able to set watchpoints in advance. With address space randomization turned off, as it still is on many systems, this would let you restart a program and find the first write to a heap data structure. (A patch has been posted for this, PR 10645.)

  • The way the code calls watchpoints "in scope" or "out of scope" is misleading: it's not about scope, it's about what the ISO C standard calls "lifetime". For example, a static variable local to some block is only "in scope" for PC values that fall within that block, but the variable's lifetime is the execution of the entire program (or until the shared library that contains the function is dlclosed). A watchpoint should be deleted when the lifetime of any of the objects it refers to ends, regardless of whether they are in scope or not. We should change the comments and the names of any related functions, variables, fields, etc. to use "lifetime" instead of "scope".

MI (Machine Interface)

  • The current MI implementation does not follow its own quoting rules, as described in the manual. Many commands delegate to CLI commands and let the CLI support code parse options themselves. We should not change the quoting rules for MI version 2, as currently implemented, but when we switch over to MI version 3 it would be good to get these correct. That means having two code paths for each mishandled command, one which imitates the existing bad quoting behavior and one which gets it right. There's a description of the current state in the GDB mailing list archives.

Embedded Debugging

None: ProjectIdeas (last edited 2021-03-10 14:25:22 by TomTromey)

All content (C) 2008 Free Software Foundation. For terms of use, redistribution, and modification, please see the WikiLicense page.