From: Vladimir Prus <vladimir@codesourcery.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] Make insert_breakpoints return void.
Date: Thu, 29 Nov 2007 18:56:00 -0000 [thread overview]
Message-ID: <200711292156.37219.vladimir@codesourcery.com> (raw)
The insert_breakpoints function has 'int' as return
type, and even tries to return something, but will
never manage to -- because on the way to returning
non-zero value it will always through an exception.
This patch adjust the prototype to match the actual
behaviour. OK?
- Volodya
* breakpoint.h (insert_breakpoints): Change
return type to void.
* breakpoint.c (insert_breakpoints): Change
return type to void. Rename local return_val
variable to error.
* infrun.c (keep_going): Instead of checking
return value from insert_breakpoints, catch exception.
---
gdb/breakpoint.c | 9 ++++-----
gdb/breakpoint.h | 2 +-
gdb/infrun.c | 7 ++++++-
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 49958e6..0f96997 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1220,11 +1220,11 @@ in which its expression is valid.\n"),
Both return zero if successful,
or an `errno' value if could not write the inferior. */
-int
+void
insert_breakpoints (void)
{
struct bp_location *b, *temp;
- int return_val = 0; /* return success code. */
+ int error = 0;
int val = 0;
int disabled_breaks = 0;
int hw_breakpoint_error = 0;
@@ -1265,10 +1265,10 @@ insert_breakpoints (void)
&disabled_breaks, &process_warning,
&hw_breakpoint_error);
if (val)
- return_val = val;
+ error = val;
}
- if (return_val)
+ if (error)
{
/* If a hardware breakpoint or watchpoint was inserted, add a
message about possibly exhausted resources. */
@@ -1286,7 +1286,6 @@ You may have requested too many hardware breakpoints/watchpoints.\n");
target_terminal_ours_for_output ();
error_stream (tmp_error_stream);
}
- return return_val;
}
int
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 4b84502..56b9a6e 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -717,7 +717,7 @@ extern void awatch_command_wrapper (char *, int);
extern void rwatch_command_wrapper (char *, int);
extern void tbreak_command (char *, int);
-extern int insert_breakpoints (void);
+extern void insert_breakpoints (void);
extern int remove_breakpoints (void);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index ad1de6b..62d6d1e 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2948,9 +2948,14 @@ keep_going (struct execution_control_state *ecs)
if (!ecs->another_trap)
{
+ struct gdb_exception e;
/* Stop stepping when inserting breakpoints
has failed. */
- if (insert_breakpoints () != 0)
+ TRY_CATCH (e, RETURN_MASK_ERROR)
+ {
+ insert_breakpoints ();
+ }
+ if (e.reason < 0)
{
stop_stepping (ecs);
return;
--
1.5.3.5
next reply other threads:[~2007-11-29 18:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-29 18:56 Vladimir Prus [this message]
2007-11-29 19:52 ` Jim Blandy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200711292156.37219.vladimir@codesourcery.com \
--to=vladimir@codesourcery.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox