Re: [PATCH] Whack some dead code

Stan Shebs
2010-03-30T17:05:31Z

Pedro Alves wrote:
> On Tuesday 30 March 2010 01:25:11, Stan Shebs wrote:
>
>> A while back, Vladimir Prus noticed a chunk of dead code in
>> trace_find_line_command; basically, if you don't have symbolic info,
>> there is no plausible fallback for line numbers, you just have to give
>> up. Committed to trunk.
>>
>
>
>> * tracepoint.c (trace_find_line_command): Remove dead code.
>>
>
> Errr, what does "dead" mean exactly? It's certainly exercisable, just
> like the comment in the code suggests:
>
> (top-gdb) help tfind line
> Select a trace frame by source line.
> Argument can be a line number (with optional source file),
> a function name, or '*' followed by an address.
> Default argument is 'the next source line that was traced'.
>

A better term is maybe "bogus code", and my explanation is misleading.
If you look at the locals start_pc and end_pc, you see that the original
code's sal.symtab == 0 case does not set them before they get passed to
tfind_1 at the bottom. I suppose one could try to salvage the sal.pc !=
0 case and treat it as a start_pc == end_pc situation; we'd would want
to think how each case is supposed to be useful. It would be a little
annoying if a typo in tfind takes you to an unexpected trace frame,
which in turn could disable your display commands, etc. "info line" is
not necessarily the right model, since as an info command it has no side
effects and can make far-out interpretations.

(Incidentally, I notice that "help info line" doesn't mention the raw
address option. Didn't it used to??)

Stan