* TODO: Add idea for "disassemble" with source.
[binutils-gdb.git] / gdb / TODO
1 Contents
2 --------
3
4 If you find inaccuracies in this list, please send mail to
5 bug-gdb@prep.ai.mit.edu.
6
7 * Things to do for Mach.
8 * General to do list.
9
10 Things to do for Mach
11 ---------------------
12
13 This section is up to date as of 28 Oct 1993.
14
15 All my attempted compilation was on douglas.gnu.ai.mit.edu.
16
17 0. Get it to compile and run again, especially for non-threaded
18 programs (some of the following are sub-tasks for this).
19
20 1. attach_command still contains a call to wait_for_inferior which is
21 wrong for Mach. Need to figure out a way to push this functionality
22 into target_attach (perhaps by having target_attach, for non-Mach
23 targets, call a function which does what is now in attach_command).
24
25 2. jtv's port contains an #ifdef which skips the call to
26 insert_step_breakpoint right after SOLIB_CREATE_INFERIOR_HOOK, but
27 goes ahead and calls insert_breakpoints. I don't understand this--the
28 comment would appear to apply to all breakpoints. Perhaps it is an
29 artifact from a previous version of the Mach port? (BTW, the modern
30 equivalent is the call to proceed from m3_create_inferior; proceed
31 inserts breakpoints).
32
33 3. Get the thread stuff to use the new generic thread code (enhancing
34 the generic thread code to include any missing features). This is
35 necessary to make thread-specific breakpoints work again. If someone
36 wants to try to patch up the old Mach threads code, need to deal with
37 the hooks for PREPARE_TO_PROCEED and ATTACH_TO_THREAD, which I haven't
38 merged--can these go in target_resume()?
39
40 4. BFD problem--"Undefined symbol _aout_32_swap_exec_header_in".
41
42 5. The linker complains about mfree and so on being multiply defined.
43 As one version is in a library, this seems like a linker bug. But I
44 think changing MMALLOC_LIB to MMALLOC in the .mh files is all that is
45 necessary to fix it.
46
47 6. i386_mach3_float_info and register_addr were undefined in the
48 link. I haven't investigated, but probably just another easy
49 configuration thing or something.
50
51 7. I couldn't find mach_port_t in any of the headers in
52 /usr/include/*.h or /usr/include/mach/*.h (I think those are the two
53 places I tried). Typedeffing it to void * in nm-m3.h seemed to work,
54 but of course that's hardly an elegant solution.
55
56 8. Implement the features which CMU gdb has which the main GDB does
57 not. This could be done by getting paperwork from CMU and merging
58 their changes, or by reimplementing them.
59
60 General To Do List
61 ------------------
62
63 This to do list is probably not up to date, and opinions may vary
64 about the importance or even desirability of some of the items.
65
66 It should be possible to use symbols from shared libraries before we know
67 exactly where the libraries will be loaded. E.g. "b perror" before running
68 the program. This could maybe be done as an extension of the "breakpoint
69 re-evaluation" after new symbols are loaded.
70
71 Make single_step() insert and remove breakpoints in one operation.
72
73 Speed up single stepping by avoiding extraneous ptrace calls.
74
75 Speed up single stepping by not inserting and removing breakpoints
76 each time the inferior starts and stops.
77
78 Breakpoints should not be inserted and deleted all the time. Only the
79 one(s) there should be removed when we have to step over one. Support
80 breakpoints that don't have to be removed to step over them.
81
82 Speed up watchpoints by using debug registers, page table diddling (on
83 SunOS4, can call mprotect() in the inferior; on other machines can do
84 something simpler), etc.
85
86 Update gdbint.texinfo to include doc on the directory structure and
87 the various tricks of building gdb.
88
89 Do a tutorial in gdb.texinfo on how to do simple things in gdb.
90 E.g. how to set a breakpoint that just prints something and continues.
91 How to break on aborts. Etc.
92
93 Provide "voodoo" debugging of core files. This creates a zombie
94 process as a child of the debugger, and loads it up with the data,
95 stack, and regs of the core file. This allows you to call functions
96 in the executable, to manipulate the data in the core file.
97
98 GDB reopens the source file on every line, as you "next" through it.
99
100 Referencing the vtbl member of a struct doesn't work. It prints OK
101 if you print the struct, but it gets 0 if you try to deref it.
102
103 Persistent command history: A feature where you could save off a list
104 of the commands you did, so you can edit it into something that will bring
105 the target to the same place every time you source it.
106 This would also be useful for automated fast watchpointing; if you go
107 past the place where it watchpoints, you just start it over again and
108 do it more carefully.
109
110 Deal with the SunOS 4.0 and 4.1.1 ptrace bug that loses the registers if
111 the stack is paged out.
112
113 Finish the C++ exception handling stub routines. Lint points them out
114 as unused statics functions.
115
116 Perhaps "i source" should take an argument like that of "list".
117
118 See if coredep.c's fetch_core_registers can be used on more machines.
119 E.g. MIPS (mips-xdep.c).
120
121 unpack_double() does not handle IEEE float on the target unless the host
122 is also IEEE. Death on a vax.
123
124 Set up interface between GDB and INFO so that you can hop into interactive
125 INFO and back out again. When running under Emacs, should use Emacs
126 info, else fork the info program. Installation of GDB should install
127 its texinfo files into the info tree automagically, including the readline
128 texinfo files.
129
130 "help address" ought to find the "help set print address" entry.
131
132 Remove the VTBL internal guts from printouts of C++ structs, unless
133 vtblprint is set.
134
135 Remove "at 0xnnnn" from the "b foo" response, if `print address off' and if
136 it matches the source line indicated.
137
138 The prompt at end of screen should accept space as well as CR.
139
140 "List" should put you into a pseudo-"more" where you can hit space to
141 get more, forever to eof. (questionable--you can already hit return
142 to get more, and modal user interfaces are evil -kingdon, 28 Oct
143 1993).
144
145 Check STORE_RETURN_VALUE on all architectures. Check near it in tm-sparc.h
146 for other bogosities.
147
148 Check for storage leaks in GDB, I'm sure there are a lot!
149
150 vtblprint of a vtbl should demangle the names it's printing.
151
152 Backtrace should point out what the currently selected frame is, in
153 its display, perhaps showing "@3 foo (bar, ...)" or ">3 foo (bar,
154 ...)" rather than "#3 foo (bar, ...)".
155
156 "i program" should work for core files, and display more info, like what
157 actually caused it to die.
158
159 "x/10i" should shorten the long name, if any, on subsequent lines.
160
161 Check through the code for FIXME comments and fix them. dbxread.c,
162 blockframe.c, and plenty more.
163
164 "next" over a function that longjumps, never stops until next time you happen
165 to get to that spot by accident. E.g. "n" over execute_command which has
166 an error.
167
168 Watchpoints seem not entirely reliable, though they haven't failed me recently.
169
170 "set zeroprint off", don't bother printing members of structs which are entirely
171 zero. Useful for those big structs with few useful members.
172
173 GDB does four ioctl's for every command, probably switching terminal modes
174 to/from inferior or for readline or something.
175
176 terminal_ours versus terminal_inferior: cache state. Switch should be a noop
177 if the state is the same, too.
178
179 ptype $i6 = void??!
180
181 Clean up invalid_float handling so gdb doesn't coredump when it tries to
182 access a NaN. While this might work on SPARC, other machines are not
183 configured right.
184
185 "b value_at ; commands ; continue ; end" stops EVERY OTHER TIME!
186 Then once you enter a command, it does the command, runs two more
187 times, and then stops again! Bizarre... (This behaviour has been
188 modified, but it is not yet 100% predictable when e.g. the commands
189 call functions in the child, and while there, the child is interrupted
190 with a signal, or hits a breakpoint.)
191
192 help completion, help history should work.
193
194 Check that we can handle stack trace through varargs AND alloca in same
195 function, on 29K.
196
197 wait_for_inferior loops forever if wait() gives it an error.
198
199 "i frame" shows wrong "arglist at" location, doesn't show where the args
200 should be found, only their actual values.
201
202 There should be a way for "set" commands to validate the new setting
203 before it takes effect.
204
205 A mess of floating point opcodes are missing from sparc-opcode.h.
206 Also, a little program should test the table for bits that are
207 overspecified or underspecified. E.g. if the must-be-ones bits
208 and the must-be-zeroes bits leave some fields unexamined, and the format
209 string leaves them unprinted, then point this out. If multiple
210 non-alias patterns match, point this out too. Finally, there should
211 be a sparc-optest.s file that tries each pattern out. This file
212 should end up coming back the same (modulo transformation comments)
213 if fed to "gas" then the .o is fed to gdb for disassembly.
214
215 Eliminate all the core_file_command's in all the xdep files.
216 Eliminate separate declarations of registers[] everywhere.
217
218 "ena d" is ambiguous, why? "ena delete" seems to think it is a command!
219
220 Line numbers are off in some spots. In proceed() at 1st "oneproc = 1",
221 it seems to run that statement, but it doesn't actually.
222
223 Perhaps move the tdep, xdep, and nat files, into the config
224 subdirectories. If not, at least straighten out their names so that
225 they all start with the machine name.
226
227 inferior_status should include stop_print_frame. It won't need to be
228 reset in wait_for_inferior after bpstat_stop_status call, then.
229
230 i line VAR produces "Line number not known for symbol ``var''.". I
231 thought we were stashing that info now!
232
233 We should be able to write to random files at hex offsets like adb.
234
235 Make "target xxx" command interruptible.
236
237 Handle add_file with separate text, data, and bss addresses. Maybe
238 handle separate addresses for each segment in the object file?
239
240 Handle free_named_symtab to cope with multiply-loaded object files
241 in a dynamic linking environment. Should remember the last copy loaded,
242 but not get too snowed if it finds references to the older copy.
243
244 The original BFD core dump reading routine would itself coredump when fed
245 a garbage file as a core file. Does the current one?
246
247 Generalize and Standardize the RPC interface to a target program,
248 improve it beyond the "ptrace" interface, and see if it can become a
249 standard for remote debugging.
250
251 Remove all references to:
252 text_offset
253 data_offset
254 text_data_start
255 text_end
256 exec_data_offset
257 ...
258 now that we have BFD. All remaining are in machine dependent files.
259
260 When quitting with a running program, if a core file was previously
261 examined, you get "Couldn't read float regs from core file"...if
262 indeed it can't. generic_mourn_inferior...
263
264 Have remote targets give a warning on a signal argument to
265 target_resume. Or better yet, extend the protocols so that it works
266 like it does on the Unix-like systems.
267
268 Sort help and info output.
269
270 Re-organize help categories into things that tend to fit on a screen
271 and hang together.
272
273 renote-nindy.c handles interrupts poorly; it error()s out of badly
274 chosen places, e.g. leaving current_frame zero, which causes core dumps
275 on the next command.
276
277 Add in commands like ADB's for searching for patterns, etc. We should
278 be able to examine and patch raw unsymboled binaries as well in gdb as
279 we can in adb. (E.g. increase the timeout in /bin/login without source).
280
281 Those xdep files that call register_addr without defining it are
282 probably simply broken. When reconfiguring this part of gdb, I could
283 only make guesses about how to redo some of those files, and I
284 probably guessed wrong, or left them "for later" when I have a
285 machine that can attempt to build them.
286
287 When doing "step" or "next", if a few lines of source are skipped between
288 the previous line and the current one, print those lines, not just the
289 last line of a multiline statement.
290
291 When searching for C++ superclasses in value_cast in valops.c, we must
292 not search the "fields", only the "superclasses". There might be a
293 struct with a field name that matches the superclass name. This can
294 happen when the struct was defined before the superclass (before the
295 name became a typedef).
296
297 Handling of "&" address-of operator needs some serious overhaul
298 for ANSI C and consistency on arrays and functions.
299 For "float point[15];":
300 ptype &point[4] ==> Attempt to take address of non-lvalue.
301 For "char *malloc();":
302 ptype malloc ==> "char *()"; should be same as
303 ptype &malloc ==> "char *(*)()"
304 call printf ("%x\n", malloc) ==> wierd value, should be same as
305 call printf ("%x\n", &malloc) ==> correct value
306
307 Fix dbxread.c symbol reading in the presence of interrupts. It
308 currently leaves a cleanup to blow away the entire symbol table when a
309 QUIT occurs. (What's wrong with that? -kingdon, 28 Oct 1993).
310
311 Mipsread.c reads include files depth-first, because the dependencies
312 in the psymtabs are way too inclusive (it seems to me). Figure out what
313 really depends on what, to avoid recursing 20 or 30 times while reading
314 real symtabs.
315
316 value_add() should be subtracting the lower bound of arrays, if known,
317 and possibly checking against the upper bound for error reporting.
318
319 mipsread.c symbol table allocation and deallocation should be checked.
320 My suspicion is that it's full of memory leaks.
321
322 SunOS should have a target_lookup_symbol() for common'd things allocated
323 by the shared library linker ld.so.
324
325 When listing source lines, check for a preceding \n, to verify that
326 the file hasn't changed out from under us.
327
328 When listing source lines, eat leading whitespace corresponding to the
329 line-number prefix we print. This avoids long lines wrapping.
330
331 mipsread.c needs to check for old symtabs and psymtabs for the same
332 files, the way it happens for dbxread.c and coffread.c, for VxWorks
333 incremental symbol table reloading.
334
335 Get all the remote systems (where the protocol allows it) to be able to
336 stop the remote system when the GDB user types ^C (like remote.c
337 does). For ebmon, use ^Ak.
338
339 Possible feature: A version of the "disassemble" command which shows
340 both source and assembly code ("set symbol-filename on" is a partial
341 solution).