* [Patch]: Little Cleanup
@ 2007-03-02 7:04 Markus Deuling
2007-03-03 9:08 ` Pedro Alves
0 siblings, 1 reply; 18+ messages in thread
From: Markus Deuling @ 2007-03-02 7:04 UTC (permalink / raw)
To: GDB Patches
[-- Attachment #1: Type: text/plain, Size: 366 bytes --]
Hi,
this patch is a little cleanup for breakpoint.c/infrun.c.
Ok to commit ?
ChangeLog:
* infrun.c (breakpoints_failed): Remove unnecessary variable.
(handle_inferior_event): Remove unnecessary braces.
* breakpoint.c (bpstat_what): Remove wrong comment.
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
[-- Attachment #2: cleanup_patch --]
[-- Type: text/plain, Size: 1854 bytes --]
diff -urN src/gdb/breakpoint.c dev/gdb/breakpoint.c
--- src/gdb/breakpoint.c 2007-02-27 20:46:04.000000000 +0100
+++ dev/gdb/breakpoint.c 2007-03-02 07:29:06.000000000 +0100
@@ -3134,8 +3134,6 @@
/* step_resume entries: a step resume breakpoint overrides another
breakpoint of signal handling (see comment in wait_for_inferior
at where we set the step_resume breakpoint). */
- /* We handle the through_sigtramp_breakpoint the same way; having both
- one of those and a step_resume_breakpoint is probably very rare (?). */
static const enum bpstat_what_main_action
table[(int) class_last][(int) BPSTAT_WHAT_LAST] =
diff -urN src/gdb/infrun.c dev/gdb/infrun.c
--- src/gdb/infrun.c 2007-03-01 06:45:40.000000000 +0100
+++ dev/gdb/infrun.c 2007-03-02 07:28:17.000000000 +0100
@@ -288,10 +288,6 @@
struct regcache *stop_registers;
-/* Nonzero if program stopped due to error trying to insert breakpoints. */
-
-static int breakpoints_failed;
-
/* Nonzero after stop if current stack frame should be printed. */
static int stop_print_frame;
@@ -1830,7 +1826,6 @@
stop_print_frame = 1;
ecs->random_signal = 0;
stopped_by_random_signal = 0;
- breakpoints_failed = 0;
if (stop_signal == TARGET_SIGNAL_TRAP
&& trap_expected
@@ -2126,9 +2121,7 @@
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_SINGLE\n");
if (breakpoints_inserted)
- {
- remove_breakpoints ();
- }
+ remove_breakpoints ();
breakpoints_inserted = 0;
ecs->another_trap = 1;
/* Still need to check other stuff, at least the case
@@ -2909,8 +2902,7 @@
if (!breakpoints_inserted && !ecs->another_trap)
{
- breakpoints_failed = insert_breakpoints ();
- if (breakpoints_failed)
+ if (insert_breakpoints ())
{
stop_stepping (ecs);
return;
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Patch]: Little Cleanup
2007-03-02 7:04 [Patch]: Little Cleanup Markus Deuling
@ 2007-03-03 9:08 ` Pedro Alves
2007-03-03 10:29 ` Eli Zaretskii
0 siblings, 1 reply; 18+ messages in thread
From: Pedro Alves @ 2007-03-03 9:08 UTC (permalink / raw)
To: Markus Deuling; +Cc: GDB Patches
Markus Deuling wrote:
> @@ -2909,8 +2902,7 @@
>
> if (!breakpoints_inserted && !ecs->another_trap)
> {
> - breakpoints_failed = insert_breakpoints ();
> - if (breakpoints_failed)
> + if (insert_breakpoints ())
> {
> stop_stepping (ecs);
> return;
>
>
Actually, I find your version harder to read for someone not knowing the
insert_breakpoints
API by heart. To me, it looks like you are testing a function that
returns a boolean.
I read it as: "if insert_breakpoints succeeded". It looks like the de
facto standard is to use:
if (insert_breakpoints () != 0)
The current version doesn't do it either, but 'breakpoints_failed'
gives a pretty good hint.
It may actually by a GNU coding convention, but I'm not sure.
(Just being picky on a Saturday morning, ignore at will.)
Cheers,
Pedro Alves
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Patch]: Little Cleanup
2007-03-03 9:08 ` Pedro Alves
@ 2007-03-03 10:29 ` Eli Zaretskii
2007-03-05 5:59 ` Markus Deuling
0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2007-03-03 10:29 UTC (permalink / raw)
To: Pedro Alves; +Cc: deuling, gdb-patches
> Date: Sat, 03 Mar 2007 09:07:49 +0000
> From: Pedro Alves <pedro_alves@portugalmail.pt>
> CC: GDB Patches <gdb-patches@sourceware.org>
>
> Markus Deuling wrote:
> > @@ -2909,8 +2902,7 @@
> >
> > if (!breakpoints_inserted && !ecs->another_trap)
> > {
> > - breakpoints_failed = insert_breakpoints ();
> > - if (breakpoints_failed)
> > + if (insert_breakpoints ())
> > {
> > stop_stepping (ecs);
> > return;
> >
> >
>
> Actually, I find your version harder to read for someone not knowing the
> insert_breakpoints API by heart.
FWIW, I agree. The new version requires a comment to be as readable
as the old one.
(Of course, I'd expect the optimizer to produce the same code from
both old and new versions.)
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Patch]: Little Cleanup
2007-03-03 10:29 ` Eli Zaretskii
@ 2007-03-05 5:59 ` Markus Deuling
2007-03-05 21:04 ` Eli Zaretskii
0 siblings, 1 reply; 18+ messages in thread
From: Markus Deuling @ 2007-03-05 5:59 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Pedro Alves, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 858 bytes --]
Hi,
thank you for your comment.
Eli Zaretskii wrote:
>>
>> Actually, I find your version harder to read for someone not knowing the
>> insert_breakpoints API by heart.
>>
>
> FWIW, I agree. The new version requires a comment to be as readable
> as the old one.
>
> (Of course, I'd expect the optimizer to produce the same code from
> both old and new versions.)
I agree.
Comment in insert_breakpoints() says:
"Both return zero if successful, or an `errno' value if ..." so
"if (insert_breakpoints () != 0)" is more clear and precise.
I changed the patch. Ok ?
ChangeLog:
* infrun.c (breakpoints_failed): Remove unnecessary variable.
(handle_inferior_event): Remove unnecessary braces.
* breakpoint.c (bpstat_what): Remove wrong comment.
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
[-- Attachment #2: cleanup_patch --]
[-- Type: text/plain, Size: 1858 bytes --]
diff -urN src/gdb/breakpoint.c dev/gdb/breakpoint.c
--- src/gdb/breakpoint.c 2007-02-27 20:46:04.000000000 +0100
+++ dev/gdb/breakpoint.c 2007-03-02 07:29:06.000000000 +0100
@@ -3134,8 +3134,6 @@
/* step_resume entries: a step resume breakpoint overrides another
breakpoint of signal handling (see comment in wait_for_inferior
at where we set the step_resume breakpoint). */
- /* We handle the through_sigtramp_breakpoint the same way; having both
- one of those and a step_resume_breakpoint is probably very rare (?). */
static const enum bpstat_what_main_action
table[(int) class_last][(int) BPSTAT_WHAT_LAST] =
diff -urN src/gdb/infrun.c dev/gdb/infrun.c
--- src/gdb/infrun.c 2007-03-01 06:45:40.000000000 +0100
+++ dev/gdb/infrun.c 2007-03-02 07:28:17.000000000 +0100
@@ -288,10 +288,6 @@
struct regcache *stop_registers;
-/* Nonzero if program stopped due to error trying to insert breakpoints. */
-
-static int breakpoints_failed;
-
/* Nonzero after stop if current stack frame should be printed. */
static int stop_print_frame;
@@ -1830,7 +1826,6 @@
stop_print_frame = 1;
ecs->random_signal = 0;
stopped_by_random_signal = 0;
- breakpoints_failed = 0;
if (stop_signal == TARGET_SIGNAL_TRAP
&& trap_expected
@@ -2126,9 +2121,7 @@
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_SINGLE\n");
if (breakpoints_inserted)
- {
- remove_breakpoints ();
- }
+ remove_breakpoints ();
breakpoints_inserted = 0;
ecs->another_trap = 1;
/* Still need to check other stuff, at least the case
@@ -2909,8 +2902,7 @@
if (!breakpoints_inserted && !ecs->another_trap)
{
- breakpoints_failed = insert_breakpoints ();
- if (breakpoints_failed)
+ if (insert_breakpoints () != 0)
{
stop_stepping (ecs);
return;
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Patch]: Little Cleanup
2007-03-05 5:59 ` Markus Deuling
@ 2007-03-05 21:04 ` Eli Zaretskii
2007-03-05 21:23 ` Mark Kettenis
0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2007-03-05 21:04 UTC (permalink / raw)
To: Markus Deuling; +Cc: pedro_alves, gdb-patches
> Date: Mon, 05 Mar 2007 06:57:50 +0100
> From: Markus Deuling <deuling@de.ibm.com>
> CC: Pedro Alves <pedro_alves@portugalmail.pt>, gdb-patches@sourceware.org
>
> if (!breakpoints_inserted && !ecs->another_trap)
> {
> - breakpoints_failed = insert_breakpoints ();
> - if (breakpoints_failed)
> + if (insert_breakpoints () != 0)
> {
> stop_stepping (ecs);
> return;
I thought we agreed about adding a comment here, something like:
/* insert_breakpoints returns non-zero if it fails to insert the
breakpoints. */
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Patch]: Little Cleanup
2007-03-05 21:04 ` Eli Zaretskii
@ 2007-03-05 21:23 ` Mark Kettenis
2007-03-05 21:23 ` Eli Zaretskii
0 siblings, 1 reply; 18+ messages in thread
From: Mark Kettenis @ 2007-03-05 21:23 UTC (permalink / raw)
To: eliz; +Cc: deuling, pedro_alves, gdb-patches
> Date: Mon, 05 Mar 2007 23:04:48 +0200
> From: Eli Zaretskii <eliz@gnu.org>
>
> > Date: Mon, 05 Mar 2007 06:57:50 +0100
> > From: Markus Deuling <deuling@de.ibm.com>
> > CC: Pedro Alves <pedro_alves@portugalmail.pt>, gdb-patches@sourceware.org
> >
> > if (!breakpoints_inserted && !ecs->another_trap)
> > {
> > - breakpoints_failed = insert_breakpoints ();
> > - if (breakpoints_failed)
> > + if (insert_breakpoints () != 0)
> > {
> > stop_stepping (ecs);
> > return;
>
> I thought we agreed about adding a comment here, something like:
>
> /* insert_breakpoints returns non-zero if it fails to insert the
> breakpoints. */
Adding this sort of comments at all call sites of such functions is
really silly.
Mark
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Patch]: Little Cleanup
2007-03-05 21:23 ` Mark Kettenis
@ 2007-03-05 21:23 ` Eli Zaretskii
2007-03-05 22:01 ` Jim Blandy
0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2007-03-05 21:23 UTC (permalink / raw)
To: Mark Kettenis; +Cc: deuling, pedro_alves, gdb-patches
> Date: Mon, 5 Mar 2007 22:19:20 +0100 (CET)
> From: Mark Kettenis <mark.kettenis@xs4all.nl>
> CC: deuling@de.ibm.com, pedro_alves@portugalmail.pt,
> gdb-patches@sourceware.org
> >
> > I thought we agreed about adding a comment here, something like:
> >
> > /* insert_breakpoints returns non-zero if it fails to insert the
> > breakpoints. */
>
> Adding this sort of comments at all call sites of such functions is
> really silly.
I don't see anything silly about making the code clearer.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch]: Little Cleanup
2007-03-05 21:23 ` Eli Zaretskii
@ 2007-03-05 22:01 ` Jim Blandy
2007-03-06 4:22 ` Eli Zaretskii
0 siblings, 1 reply; 18+ messages in thread
From: Jim Blandy @ 2007-03-05 22:01 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Mark Kettenis, deuling, pedro_alves, gdb-patches
Eli Zaretskii <eliz@gnu.org> writes:
>> Date: Mon, 5 Mar 2007 22:19:20 +0100 (CET)
>> From: Mark Kettenis <mark.kettenis@xs4all.nl>
>> CC: deuling@de.ibm.com, pedro_alves@portugalmail.pt,
>> gdb-patches@sourceware.org
>> >
>> > I thought we agreed about adding a comment here, something like:
>> >
>> > /* insert_breakpoints returns non-zero if it fails to insert the
>> > breakpoints. */
>>
>> Adding this sort of comments at all call sites of such functions is
>> really silly.
>
> I don't see anything silly about making the code clearer.
I'm confident Mark believes clarifying code is not silly. I think
Mark disagrees that the comment you requested is, in fact, a
clarification.
I tend to agree with Mark, here. The place to document the meaning of
a function's return value is at the function, not at each of its call
sites.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch]: Little Cleanup
2007-03-05 22:01 ` Jim Blandy
@ 2007-03-06 4:22 ` Eli Zaretskii
2007-03-06 19:53 ` Joel Brobecker
0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2007-03-06 4:22 UTC (permalink / raw)
To: Jim Blandy; +Cc: mark.kettenis, deuling, pedro_alves, gdb-patches
> Cc: Mark Kettenis <mark.kettenis@xs4all.nl>, deuling@de.ibm.com,
> pedro_alves@portugalmail.pt, gdb-patches@sourceware.org
> From: Jim Blandy <jimb@codesourcery.com>
> Date: Mon, 05 Mar 2007 14:01:18 -0800
>
> The place to document the meaning of a function's return value is at
> the function, not at each of its call sites.
So you are saying that it's normal to expect the code reader to
constantly jump to the function's definition trying to understand what
its callers try to accomplish?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch]: Little Cleanup
2007-03-06 4:22 ` Eli Zaretskii
@ 2007-03-06 19:53 ` Joel Brobecker
2007-03-06 20:40 ` Michael Snyder
2007-03-06 21:03 ` Eli Zaretskii
0 siblings, 2 replies; 18+ messages in thread
From: Joel Brobecker @ 2007-03-06 19:53 UTC (permalink / raw)
To: Eli Zaretskii
Cc: Jim Blandy, mark.kettenis, deuling, pedro_alves, gdb-patches
> > The place to document the meaning of a function's return value is at
> > the function, not at each of its call sites.
>
> So you are saying that it's normal to expect the code reader to
> constantly jump to the function's definition trying to understand what
> its callers try to accomplish?
Then perhaps this suggests that the function could be renamed into
something clearer? But otherwise, yes, I agree with Jim and Mark,
because maintaining these comments everywhere is going to be an issue.
--
Joel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch]: Little Cleanup
2007-03-06 19:53 ` Joel Brobecker
@ 2007-03-06 20:40 ` Michael Snyder
2007-03-06 21:03 ` Eli Zaretskii
1 sibling, 0 replies; 18+ messages in thread
From: Michael Snyder @ 2007-03-06 20:40 UTC (permalink / raw)
To: Joel Brobecker
Cc: Eli Zaretskii, Jim Blandy, mark.kettenis, deuling, pedro_alves,
gdb-patches
On Tue, 2007-03-06 at 11:52 -0800, Joel Brobecker wrote:
> > > The place to document the meaning of a function's return value is at
> > > the function, not at each of its call sites.
> >
> > So you are saying that it's normal to expect the code reader to
> > constantly jump to the function's definition trying to understand what
> > its callers try to accomplish?
>
> Then perhaps this suggests that the function could be renamed into
> something clearer? But otherwise, yes, I agree with Jim and Mark,
> because maintaining these comments everywhere is going to be an issue.
Yes. The logical place for a function to be documented is
at the definition -- not at the call.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch]: Little Cleanup
2007-03-06 19:53 ` Joel Brobecker
2007-03-06 20:40 ` Michael Snyder
@ 2007-03-06 21:03 ` Eli Zaretskii
2007-03-06 22:10 ` Ulrich Weigand
1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2007-03-06 21:03 UTC (permalink / raw)
To: Joel Brobecker; +Cc: jimb, mark.kettenis, deuling, pedro_alves, gdb-patches
> Date: Tue, 6 Mar 2007 11:52:11 -0800
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: Jim Blandy <jimb@codesourcery.com>, mark.kettenis@xs4all.nl,
> deuling@de.ibm.com, pedro_alves@portugalmail.pt,
> gdb-patches@sourceware.org
>
> Then perhaps this suggests that the function could be renamed into
> something clearer?
Fine with me. Note that the original code had a local variable that
made this clear; this whole discussion was caused by a patch that
removed that variable.
> But otherwise, yes, I agree with Jim and Mark,
> because maintaining these comments everywhere is going to be an issue.
I never said anything about ``maintaining these comments everywhere''.
There's no need for such generalizations.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch]: Little Cleanup
2007-03-06 21:03 ` Eli Zaretskii
@ 2007-03-06 22:10 ` Ulrich Weigand
2007-03-07 7:36 ` Markus Deuling
0 siblings, 1 reply; 18+ messages in thread
From: Ulrich Weigand @ 2007-03-06 22:10 UTC (permalink / raw)
To: eliz
Cc: Joel Brobecker, jimb, mark.kettenis, deuling, pedro_alves, gdb-patches
Eli Zaretskii wrote:
> Fine with me. Note that the original code had a local variable that
> made this clear; this whole discussion was caused by a patch that
> removed that variable.
Actually, the original code had a *global* static variable that was
used only at this single location -- cleaning this up was really the
point of the patch, I guess.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch]: Little Cleanup
2007-03-06 22:10 ` Ulrich Weigand
@ 2007-03-07 7:36 ` Markus Deuling
2007-03-07 12:15 ` Daniel Jacobowitz
2007-03-07 16:34 ` Eli Zaretskii
0 siblings, 2 replies; 18+ messages in thread
From: Markus Deuling @ 2007-03-07 7:36 UTC (permalink / raw)
To: gdb-patches
Cc: eliz, Joel Brobecker, jimb, mark.kettenis, deuling, pedro_alves,
Ulrich Weigand
[-- Attachment #1: Type: text/plain, Size: 762 bytes --]
Ulrich Weigand wrote:
> Eli Zaretskii wrote:
>
>
>> Fine with me. Note that the original code had a local variable that
>> made this clear; this whole discussion was caused by a patch that
>> removed that variable.
>>
>
> Actually, the original code had a *global* static variable that was
> used only at this single location -- cleaning this up was really the
> point of the patch, I guess.
>
> Bye,
> Ulrich
>
>
The function "handle_inferior_event"'s length is >1450 (!!!) lines of
code and I think its
a good idea to clean it up if possible. The patch removes an unnecessary
variable from that function. To increase the readability I added a
comment to the patch.
Ok?
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
[-- Attachment #2: cleanup_patch_1 --]
[-- Type: text/plain, Size: 1943 bytes --]
diff -urN src/gdb/breakpoint.c dev/gdb/breakpoint.c
--- src/gdb/breakpoint.c 2007-02-27 20:46:04.000000000 +0100
+++ dev/gdb/breakpoint.c 2007-03-07 08:23:06.000000000 +0100
@@ -3134,8 +3134,6 @@
/* step_resume entries: a step resume breakpoint overrides another
breakpoint of signal handling (see comment in wait_for_inferior
at where we set the step_resume breakpoint). */
- /* We handle the through_sigtramp_breakpoint the same way; having both
- one of those and a step_resume_breakpoint is probably very rare (?). */
static const enum bpstat_what_main_action
table[(int) class_last][(int) BPSTAT_WHAT_LAST] =
diff -urN src/gdb/infrun.c dev/gdb/infrun.c
--- src/gdb/infrun.c 2007-03-01 06:45:40.000000000 +0100
+++ dev/gdb/infrun.c 2007-03-07 08:24:33.000000000 +0100
@@ -288,10 +288,6 @@
struct regcache *stop_registers;
-/* Nonzero if program stopped due to error trying to insert breakpoints. */
-
-static int breakpoints_failed;
-
/* Nonzero after stop if current stack frame should be printed. */
static int stop_print_frame;
@@ -1830,7 +1826,6 @@
stop_print_frame = 1;
ecs->random_signal = 0;
stopped_by_random_signal = 0;
- breakpoints_failed = 0;
if (stop_signal == TARGET_SIGNAL_TRAP
&& trap_expected
@@ -2126,9 +2121,7 @@
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_SINGLE\n");
if (breakpoints_inserted)
- {
- remove_breakpoints ();
- }
+ remove_breakpoints ();
breakpoints_inserted = 0;
ecs->another_trap = 1;
/* Still need to check other stuff, at least the case
@@ -2909,8 +2902,9 @@
if (!breakpoints_inserted && !ecs->another_trap)
{
- breakpoints_failed = insert_breakpoints ();
- if (breakpoints_failed)
+ /* Stop stepping when inserting breakpoints
+ has failed. */
+ if (insert_breakpoints () != 0)
{
stop_stepping (ecs);
return;
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Patch]: Little Cleanup
2007-03-07 7:36 ` Markus Deuling
@ 2007-03-07 12:15 ` Daniel Jacobowitz
2007-03-07 16:34 ` Eli Zaretskii
1 sibling, 0 replies; 18+ messages in thread
From: Daniel Jacobowitz @ 2007-03-07 12:15 UTC (permalink / raw)
To: Markus Deuling
Cc: gdb-patches, eliz, Joel Brobecker, jimb, mark.kettenis,
pedro_alves, Ulrich Weigand
On Wed, Mar 07, 2007 at 08:34:57AM +0100, Markus Deuling wrote:
> - breakpoints_failed = insert_breakpoints ();
> - if (breakpoints_failed)
> + /* Stop stepping when inserting breakpoints
> + has failed. */
> + if (insert_breakpoints () != 0)
If you check this in, please fix the whitespace (tabs versus spaces).
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch]: Little Cleanup
2007-03-07 7:36 ` Markus Deuling
2007-03-07 12:15 ` Daniel Jacobowitz
@ 2007-03-07 16:34 ` Eli Zaretskii
2007-03-09 4:48 ` Markus Deuling
1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2007-03-07 16:34 UTC (permalink / raw)
To: Markus Deuling
Cc: gdb-patches, brobecker, jimb, mark.kettenis, deuling,
pedro_alves, uweigand
> Date: Wed, 07 Mar 2007 08:34:57 +0100
> From: Markus Deuling <deuling@de.ibm.com>
> CC: eliz@gnu.org, Joel Brobecker <brobecker@adacore.com>,
> jimb@codesourcery.com, mark.kettenis@xs4all.nl, deuling@de.ibm.com,
> pedro_alves@portugalmail.pt, Ulrich Weigand <uweigand@de.ibm.com>
> >
> The function "handle_inferior_event"'s length is >1450 (!!!) lines of
> code and I think its
> a good idea to clean it up if possible. The patch removes an unnecessary
> variable from that function. To increase the readability I added a
> comment to the patch.
>
> Ok?
Fine with me, thanks.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Patch]: Little Cleanup
2007-03-07 16:34 ` Eli Zaretskii
@ 2007-03-09 4:48 ` Markus Deuling
2007-03-09 16:21 ` Ulrich Weigand
0 siblings, 1 reply; 18+ messages in thread
From: Markus Deuling @ 2007-03-09 4:48 UTC (permalink / raw)
To: Eli Zaretskii
Cc: gdb-patches, brobecker, jimb, mark.kettenis, pedro_alves, uweigand
[-- Attachment #1: Type: text/plain, Size: 389 bytes --]
Eli Zaretskii wrote:
>>
>> Ok?
>
> Fine with me, thanks.
>
Ok,
this is the version with comments and tabs.
ChangeLog:
* infrun.c (breakpoints_failed): Remove unnecessary variable.
(handle_inferior_event): Remove unnecessary braces.
* breakpoint.c (bpstat_what): Remove wrong comme
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
[-- Attachment #2: cleanup_patch --]
[-- Type: text/plain, Size: 1922 bytes --]
diff -urN src/gdb/breakpoint.c dev/gdb/breakpoint.c
--- src/gdb/breakpoint.c 2007-02-27 20:46:04.000000000 +0100
+++ dev/gdb/breakpoint.c 2007-03-07 08:23:06.000000000 +0100
@@ -3134,8 +3134,6 @@
/* step_resume entries: a step resume breakpoint overrides another
breakpoint of signal handling (see comment in wait_for_inferior
at where we set the step_resume breakpoint). */
- /* We handle the through_sigtramp_breakpoint the same way; having both
- one of those and a step_resume_breakpoint is probably very rare (?). */
static const enum bpstat_what_main_action
table[(int) class_last][(int) BPSTAT_WHAT_LAST] =
diff -urN src/gdb/infrun.c dev/gdb/infrun.c
--- src/gdb/infrun.c 2007-03-01 06:45:40.000000000 +0100
+++ dev/gdb/infrun.c 2007-03-08 06:00:08.000000000 +0100
@@ -288,10 +288,6 @@
struct regcache *stop_registers;
-/* Nonzero if program stopped due to error trying to insert breakpoints. */
-
-static int breakpoints_failed;
-
/* Nonzero after stop if current stack frame should be printed. */
static int stop_print_frame;
@@ -1830,7 +1826,6 @@
stop_print_frame = 1;
ecs->random_signal = 0;
stopped_by_random_signal = 0;
- breakpoints_failed = 0;
if (stop_signal == TARGET_SIGNAL_TRAP
&& trap_expected
@@ -2126,9 +2121,7 @@
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_SINGLE\n");
if (breakpoints_inserted)
- {
- remove_breakpoints ();
- }
+ remove_breakpoints ();
breakpoints_inserted = 0;
ecs->another_trap = 1;
/* Still need to check other stuff, at least the case
@@ -2909,8 +2902,9 @@
if (!breakpoints_inserted && !ecs->another_trap)
{
- breakpoints_failed = insert_breakpoints ();
- if (breakpoints_failed)
+ /* Stop stepping when inserting breakpoints
+ has failed. */
+ if (insert_breakpoints () != 0)
{
stop_stepping (ecs);
return;
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [Patch]: Little Cleanup
2007-03-09 4:48 ` Markus Deuling
@ 2007-03-09 16:21 ` Ulrich Weigand
0 siblings, 0 replies; 18+ messages in thread
From: Ulrich Weigand @ 2007-03-09 16:21 UTC (permalink / raw)
To: Markus Deuling
Cc: Eli Zaretskii, gdb-patches, brobecker, jimb, mark.kettenis, pedro_alves
Markus Deuling wrote:
> * infrun.c (breakpoints_failed): Remove unnecessary variable.
> (handle_inferior_event): Remove unnecessary braces.
> * breakpoint.c (bpstat_what): Remove wrong comme
I've committed this version now, thanks.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2007-03-09 16:21 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-02 7:04 [Patch]: Little Cleanup Markus Deuling
2007-03-03 9:08 ` Pedro Alves
2007-03-03 10:29 ` Eli Zaretskii
2007-03-05 5:59 ` Markus Deuling
2007-03-05 21:04 ` Eli Zaretskii
2007-03-05 21:23 ` Mark Kettenis
2007-03-05 21:23 ` Eli Zaretskii
2007-03-05 22:01 ` Jim Blandy
2007-03-06 4:22 ` Eli Zaretskii
2007-03-06 19:53 ` Joel Brobecker
2007-03-06 20:40 ` Michael Snyder
2007-03-06 21:03 ` Eli Zaretskii
2007-03-06 22:10 ` Ulrich Weigand
2007-03-07 7:36 ` Markus Deuling
2007-03-07 12:15 ` Daniel Jacobowitz
2007-03-07 16:34 ` Eli Zaretskii
2007-03-09 4:48 ` Markus Deuling
2007-03-09 16:21 ` Ulrich Weigand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox