* [PATCH] dead code in mi-interp
@ 2007-08-08 22:25 msnyder
2007-08-08 23:24 ` Nick Roberts
0 siblings, 1 reply; 13+ messages in thread
From: msnyder @ 2007-08-08 22:25 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 72 bytes --]
Must have been meant for something, but seems to have no side effects.
[-- Attachment #2: 287.txt --]
[-- Type: text/plain, Size: 1401 bytes --]
2007-08-08 Michael Snyder <msnyder@access-company.com>
* mi/mi-interp.c (mi_cmd_interpreter_exec): Dead code, dead variable.
Index: mi/mi-interp.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-interp.c,v
retrieving revision 1.20
diff -p -r1.20 mi-interp.c
*** mi/mi-interp.c 28 Apr 2007 21:52:38 -0000 1.20
--- mi/mi-interp.c 8 Aug 2007 22:23:16 -0000
*************** mi_cmd_interpreter_exec (char *command,
*** 218,235 ****
for (i = 1; i < argc; i++)
{
- char *buff = NULL;
- /* Do this in a cleaner way... We want to force execution to be
- asynchronous for commands that run the target. */
- if (target_can_async_p () && (strcmp (argv[0], "console") == 0))
- {
- int len = strlen (argv[i]);
- buff = xmalloc (len + 2);
- memcpy (buff, argv[i], len);
- buff[len] = '&';
- buff[len + 1] = '\0';
- }
-
/* We had to set sync_execution = 0 for the mi (well really for Project
Builder's use of the mi - particularly so interrupting would work.
But for console commands to work, we need to initialize it to 1 -
--- 218,223 ----
*************** mi_cmd_interpreter_exec (char *command,
*** 245,251 ****
break;
}
}
- xfree (buff);
do_exec_error_cleanups (ALL_CLEANUPS);
sync_execution = 0;
}
--- 233,238 ----
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] dead code in mi-interp
2007-08-08 22:25 [PATCH] dead code in mi-interp msnyder
@ 2007-08-08 23:24 ` Nick Roberts
2007-08-09 14:47 ` Jim Blandy
2007-08-09 14:57 ` Daniel Jacobowitz
0 siblings, 2 replies; 13+ messages in thread
From: Nick Roberts @ 2007-08-08 23:24 UTC (permalink / raw)
To: msnyder; +Cc: gdb-patches
> Must have been meant for something, but seems to have no side effects.
There are probably no side effects because currently target_can_async_p ()
usually returns 0. I hope to add an option to make GDB work asynchronously
after 6.7 is released. Maybe this still won't be needed but I don't really
like these kinds of changes. As they say: "If it ain't broke, don't fix it.".
There must be larger cobwebs to blow away.
> 2007-08-08 Michael Snyder <msnyder@access-company.com>
>
> * mi/mi-interp.c (mi_cmd_interpreter_exec): Dead code, dead variable.
--
Nick http://www.inet.net.nz/~nickrob
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] dead code in mi-interp
2007-08-08 23:24 ` Nick Roberts
@ 2007-08-09 14:47 ` Jim Blandy
2007-08-09 14:57 ` Daniel Jacobowitz
1 sibling, 0 replies; 13+ messages in thread
From: Jim Blandy @ 2007-08-09 14:47 UTC (permalink / raw)
To: Nick Roberts; +Cc: msnyder, gdb-patches
Nick Roberts <nickrob@snap.net.nz> writes:
> There must be larger cobwebs to blow away.
But the larger cobwebs are not served to you on a silver Coverity
platter. :)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] dead code in mi-interp
2007-08-08 23:24 ` Nick Roberts
2007-08-09 14:47 ` Jim Blandy
@ 2007-08-09 14:57 ` Daniel Jacobowitz
2007-08-09 21:12 ` Nick Roberts
1 sibling, 1 reply; 13+ messages in thread
From: Daniel Jacobowitz @ 2007-08-09 14:57 UTC (permalink / raw)
To: Nick Roberts; +Cc: msnyder, gdb-patches
On Thu, Aug 09, 2007 at 11:23:49AM +1200, Nick Roberts wrote:
> > Must have been meant for something, but seems to have no side effects.
>
> There are probably no side effects because currently target_can_async_p ()
> usually returns 0. I hope to add an option to make GDB work asynchronously
> after 6.7 is released. Maybe this still won't be needed but I don't really
> like these kinds of changes. As they say: "If it ain't broke, don't fix it.".
> There must be larger cobwebs to blow away.
That's not what "no side effects" means - the code literally can't
ever have an effect. It creates a string which nothing uses. Why
keep it?
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] dead code in mi-interp
2007-08-09 14:57 ` Daniel Jacobowitz
@ 2007-08-09 21:12 ` Nick Roberts
2007-08-09 21:29 ` msnyder
0 siblings, 1 reply; 13+ messages in thread
From: Nick Roberts @ 2007-08-09 21:12 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: msnyder, gdb-patches
> That's not what "no side effects" means - the code literally can't
> ever have an effect. It creates a string which nothing uses. Why
> keep it?
OK, I hadn't realised that. Unless the original author (Andrew Cagney?)
explains why it's not needed I would still prefer that it wasn't removed. It
may be that it just wasn't hooked up because the asynchronous stuff was never
completed. Once GDB can work asynchronously then it could be removed, if not
needed. Presumably "no side effects" also means "can do no harm".
--
Nick http://www.inet.net.nz/~nickrob
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] dead code in mi-interp
2007-08-09 21:12 ` Nick Roberts
@ 2007-08-09 21:29 ` msnyder
2007-08-09 22:11 ` Bob Rossi
2007-08-10 4:00 ` Nick Roberts
0 siblings, 2 replies; 13+ messages in thread
From: msnyder @ 2007-08-09 21:29 UTC (permalink / raw)
To: Nick Roberts; +Cc: Daniel Jacobowitz, msnyder, gdb-patches
> > That's not what "no side effects" means - the code literally can't
> > ever have an effect. It creates a string which nothing uses. Why
> > keep it?
>
> OK, I hadn't realised that. Unless the original author (Andrew Cagney?)
> explains why it's not needed I would still prefer that it wasn't removed.
> It
> may be that it just wasn't hooked up because the asynchronous stuff was
> never
> completed. Once GDB can work asynchronously then it could be removed, if
> not
> needed. Presumably "no side effects" also means "can do no harm".
Well, it can always be recovered from the CVS repository if it is
needed. Personally I'd rathern not have dead code in there just
because it doesn't do any harm (unles it also has some benefit).
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] dead code in mi-interp
2007-08-09 21:29 ` msnyder
@ 2007-08-09 22:11 ` Bob Rossi
2007-08-10 4:00 ` Nick Roberts
1 sibling, 0 replies; 13+ messages in thread
From: Bob Rossi @ 2007-08-09 22:11 UTC (permalink / raw)
To: msnyder; +Cc: Nick Roberts, Daniel Jacobowitz, gdb-patches
On Thu, Aug 09, 2007 at 02:28:52PM -0700, msnyder@sonic.net wrote:
> > > That's not what "no side effects" means - the code literally can't
> > > ever have an effect. It creates a string which nothing uses. Why
> > > keep it?
> >
> > OK, I hadn't realised that. Unless the original author (Andrew Cagney?)
> > explains why it's not needed I would still prefer that it wasn't removed.
> > It
> > may be that it just wasn't hooked up because the asynchronous stuff was
> > never
> > completed. Once GDB can work asynchronously then it could be removed, if
> > not
> > needed. Presumably "no side effects" also means "can do no harm".
>
> Well, it can always be recovered from the CVS repository if it is
> needed. Personally I'd rathern not have dead code in there just
> because it doesn't do any harm (unles it also has some benefit).
Agreed.
Bob Rossi
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] dead code in mi-interp
2007-08-09 21:29 ` msnyder
2007-08-09 22:11 ` Bob Rossi
@ 2007-08-10 4:00 ` Nick Roberts
2007-08-10 11:22 ` Bob Rossi
1 sibling, 1 reply; 13+ messages in thread
From: Nick Roberts @ 2007-08-10 4:00 UTC (permalink / raw)
To: msnyder; +Cc: Daniel Jacobowitz, gdb-patches
> > It may be that it just wasn't hooked up because the asynchronous stuff was
> > never completed. Once GDB can work asynchronously then it could be
> > removed, if not needed. Presumably "no side effects" also means "can do
> > no harm".
>
> Well, it can always be recovered from the CVS repository if it is
> needed. Personally I'd rathern not have dead code in there just
> because it doesn't do any harm (unles it also has some benefit).
You would only think of recovering it if you already knew it was there. I've
just explained what I think is the benefit: they provide possible clues about
an asynchronous implementation. This specific change is too small to worry
about but collectively I think you're erasing the past. Maybe the code should
read:
...
struct gdb_exception e = interp_exec (interp_to_use, buff);
^^^^
Note that with synchronous execution you currently get:
(gdb) run &
Asynchronous execution not supported on this target.
(gdb)
--
Nick http://www.inet.net.nz/~nickrob
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] dead code in mi-interp
2007-08-10 4:00 ` Nick Roberts
@ 2007-08-10 11:22 ` Bob Rossi
2007-08-10 21:49 ` msnyder
0 siblings, 1 reply; 13+ messages in thread
From: Bob Rossi @ 2007-08-10 11:22 UTC (permalink / raw)
To: Nick Roberts; +Cc: msnyder, Daniel Jacobowitz, gdb-patches
On Fri, Aug 10, 2007 at 04:00:18PM +1200, Nick Roberts wrote:
> > > It may be that it just wasn't hooked up because the asynchronous stuff was
> > > never completed. Once GDB can work asynchronously then it could be
> > > removed, if not needed. Presumably "no side effects" also means "can do
> > > no harm".
> >
> > Well, it can always be recovered from the CVS repository if it is
> > needed. Personally I'd rathern not have dead code in there just
> > because it doesn't do any harm (unles it also has some benefit).
>
> You would only think of recovering it if you already knew it was there. I've
> just explained what I think is the benefit: they provide possible clues about
> an asynchronous implementation.
Even if that was true, the code should be commented out. It really is a
bad thing to have code in the program that is meaningless.
Bob Rossi
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] dead code in mi-interp
2007-08-10 11:22 ` Bob Rossi
@ 2007-08-10 21:49 ` msnyder
2007-08-13 22:47 ` ping " msnyder
0 siblings, 1 reply; 13+ messages in thread
From: msnyder @ 2007-08-10 21:49 UTC (permalink / raw)
To: Bob Rossi; +Cc: Nick Roberts, msnyder, Daniel Jacobowitz, gdb-patches
> On Fri, Aug 10, 2007 at 04:00:18PM +1200, Nick Roberts wrote:
>> > > It may be that it just wasn't hooked up because the asynchronous
>> stuff was
>> > > never completed. Once GDB can work asynchronously then it could be
>> > > removed, if not needed. Presumably "no side effects" also means
>> "can do
>> > > no harm".
>> >
>> > Well, it can always be recovered from the CVS repository if it is
>> > needed. Personally I'd rathern not have dead code in there just
>> > because it doesn't do any harm (unles it also has some benefit).
>>
>> You would only think of recovering it if you already knew it was there.
>> I've
>> just explained what I think is the benefit: they provide possible clues
>> about
>> an asynchronous implementation.
>
> Even if that was true, the code should be commented out. It really is a
> bad thing to have code in the program that is meaningless.
And as I recall, the precident is that if you #if 0 something out,
you remove it.
^ permalink raw reply [flat|nested] 13+ messages in thread
* ping Re: [PATCH] dead code in mi-interp
2007-08-10 21:49 ` msnyder
@ 2007-08-13 22:47 ` msnyder
2007-08-14 11:27 ` Nick Roberts
0 siblings, 1 reply; 13+ messages in thread
From: msnyder @ 2007-08-13 22:47 UTC (permalink / raw)
To: msnyder; +Cc: Bob Rossi, Nick Roberts, msnyder, Daniel Jacobowitz, gdb-patches
>> On Fri, Aug 10, 2007 at 04:00:18PM +1200, Nick Roberts wrote:
>>> > > It may be that it just wasn't hooked up because the asynchronous
>>> stuff was
>>> > > never completed. Once GDB can work asynchronously then it could
>>> be
>>> > > removed, if not needed. Presumably "no side effects" also means
>>> "can do
>>> > > no harm".
>>> >
>>> > Well, it can always be recovered from the CVS repository if it is
>>> > needed. Personally I'd rathern not have dead code in there just
>>> > because it doesn't do any harm (unles it also has some benefit).
>>>
>>> You would only think of recovering it if you already knew it was there.
>>> I've
>>> just explained what I think is the benefit: they provide possible clues
>>> about
>>> an asynchronous implementation.
>>
>> Even if that was true, the code should be commented out. It really is a
>> bad thing to have code in the program that is meaningless.
>
> And as I recall, the precident is that if you #if 0 something out,
> you remove it.
So it seems like three people favor removing it, and one person opposes.
Can we reach a resolution?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ping Re: [PATCH] dead code in mi-interp
2007-08-13 22:47 ` ping " msnyder
@ 2007-08-14 11:27 ` Nick Roberts
2007-08-14 19:51 ` msnyder
0 siblings, 1 reply; 13+ messages in thread
From: Nick Roberts @ 2007-08-14 11:27 UTC (permalink / raw)
To: msnyder; +Cc: Bob Rossi, Daniel Jacobowitz, gdb-patches
> So it seems like three people favor removing it, and one person opposes.
>
> Can we reach a resolution?
I don't feel that strongly about it and, in any case, the MAINTAINERS file says
that you have the authority to make the change. Go for it.
--
Nick http://www.inet.net.nz/~nickrob
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ping Re: [PATCH] dead code in mi-interp
2007-08-14 11:27 ` Nick Roberts
@ 2007-08-14 19:51 ` msnyder
0 siblings, 0 replies; 13+ messages in thread
From: msnyder @ 2007-08-14 19:51 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb-patches
> > So it seems like three people favor removing it, and one person
> opposes.
> >
> > Can we reach a resolution?
>
> I don't feel that strongly about it and, in any case, the MAINTAINERS file
> says
> that you have the authority to make the change. Go for it.
Thanks, Nick.
Committing.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2007-08-14 19:51 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-08 22:25 [PATCH] dead code in mi-interp msnyder
2007-08-08 23:24 ` Nick Roberts
2007-08-09 14:47 ` Jim Blandy
2007-08-09 14:57 ` Daniel Jacobowitz
2007-08-09 21:12 ` Nick Roberts
2007-08-09 21:29 ` msnyder
2007-08-09 22:11 ` Bob Rossi
2007-08-10 4:00 ` Nick Roberts
2007-08-10 11:22 ` Bob Rossi
2007-08-10 21:49 ` msnyder
2007-08-13 22:47 ` ping " msnyder
2007-08-14 11:27 ` Nick Roberts
2007-08-14 19:51 ` msnyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox