public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* broken code
@ 2000-11-30 19:51 Tom Tromey
  2000-12-01  6:27 ` Fernando Nasser
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2000-11-30 19:51 UTC (permalink / raw)
  To: Insight List

I see this in gdbtk-hooks.c:

  xasprintf (&buf, "gdbtk_tcl_breakpoint %s %d 0x%lx %d {%s} {%s} %d %d",
	   action, b->number, (long) b->address, b->line_number, filename,
	   bpdisp[b->disposition], b->enable, b->thread);

In general, code like this is simply broken.  Using `{%s}' works for
some situations, but not others.  It seems to work, since it works in
the common cases, but it makes gdbtk less robust.

If you need to build a list, you should use the Tcl DString functions.

Maybe everybody working on the code already knows this.  I don't know.
I didn't look to see who writes this sort of thing (I'd rather not
know :-).

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: broken code
  2000-11-30 19:51 broken code Tom Tromey
@ 2000-12-01  6:27 ` Fernando Nasser
  0 siblings, 0 replies; 2+ messages in thread
From: Fernando Nasser @ 2000-12-01  6:27 UTC (permalink / raw)
  To: tromey; +Cc: Insight List

Tom Tromey wrote:
> 
> I see this in gdbtk-hooks.c:
> 
>   xasprintf (&buf, "gdbtk_tcl_breakpoint %s %d 0x%lx %d {%s} {%s} %d %d",
>            action, b->number, (long) b->address, b->line_number, filename,
>            bpdisp[b->disposition], b->enable, b->thread);
> 
> In general, code like this is simply broken.  Using `{%s}' works for
> some situations, but not others.  It seems to work, since it works in
> the common cases, but it makes gdbtk less robust.
> 
> If you need to build a list, you should use the Tcl DString functions.
> 
> Maybe everybody working on the code already knows this.  I don't know.
> I didn't look to see who writes this sort of thing (I'd rather not
> know :-).
> 

We should leave the code in the gdbtk-* files alone for a while.  Most
of it will either move to gdb as part of the libgdb or will be changed
to call libgdb functions or use the MI interface.

And, "in ain't broken, don't fix it" :-)



-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-12-01  6:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-30 19:51 broken code Tom Tromey
2000-12-01  6:27 ` Fernando Nasser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).