From: Tom Tromey <tromey@redhat.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [0/6] breakpoints_ops for all kinds of breakpoints
Date: Mon, 25 Jul 2011 16:20:00 -0000 [thread overview]
Message-ID: <m37h76tl5x.fsf@fleche.redhat.com> (raw)
In-Reply-To: <201107251232.04343.pedro@codesourcery.com> (Pedro Alves's message of "Mon, 25 Jul 2011 12:32:04 +0100")
Tom> I think we could make most of the vtable pointers (but not objects due
Tom> to the initialization approach) const. I think that would help clarity
Tom> a bit. I'm happy to do this after these patches go in.
Pedro> Yeah, please go ahead.
Patch appended. Built and regtested by the buildbot.
I'm committing it.
Tom
2011-07-25 Tom Tromey <tromey@redhat.com>
* ada-lang.c (ada_exception_breakpoint_ops): Make return type
const.
(ada_exception_sal): Make 'ops' const.
(ada_decode_exception_location): Likewise.
(ada_decode_assert_location): Likewise.
(catch_assert_command): Update.
(catch_ada_exception_command): Update.
(create_ada_exception_catchpoint): Make 'ops' const.
* breakpoint.c (set_raw_breakpoint_without_location)
(set_raw_breakpoint, momentary_breakpoint_from_master): Make 'ops'
const.
(create_internal_breakpoint): Update.
(init_raw_breakpoint_without_location): Make 'ops' const.
(init_raw_breakpoint, init_catchpoint)
(create_fork_vfork_event_catchpoint)
(create_syscall_event_catchpoint, init_breakpoint_sal)
(create_breakpoint_sal, create_breakpoints_sal)
(create_breakpoint, init_ada_exception_breakpoint): Likewise.
* breakpoint.h (struct breakpoint) <ops>: Now const.
(init_ada_exception_breakpoint, create_breakpoint): Make 'ops'
const.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index d017800..02115de 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -10863,7 +10863,7 @@ ada_exception_name_addr (enum exception_catchpoint_kind ex,
static struct symtab_and_line ada_exception_sal (enum exception_catchpoint_kind,
char *, char **,
- struct breakpoint_ops **);
+ const struct breakpoint_ops **);
static char *ada_exception_catchpoint_cond_string (const char *excep_string);
/* Ada catchpoints.
@@ -11538,7 +11538,7 @@ ada_exception_sym_name (enum exception_catchpoint_kind ex)
/* Return the breakpoint ops "virtual table" used for catchpoints
of the EX kind. */
-static struct breakpoint_ops *
+static const struct breakpoint_ops *
ada_exception_breakpoint_ops (enum exception_catchpoint_kind ex)
{
switch (ex)
@@ -11613,7 +11613,7 @@ ada_exception_catchpoint_cond_string (const char *excep_string)
static struct symtab_and_line
ada_exception_sal (enum exception_catchpoint_kind ex, char *excep_string,
- char **addr_string, struct breakpoint_ops **ops)
+ char **addr_string, const struct breakpoint_ops **ops)
{
const char *sym_name;
struct symbol *sym;
@@ -11676,7 +11676,7 @@ ada_exception_sal (enum exception_catchpoint_kind ex, char *excep_string,
static struct symtab_and_line
ada_decode_exception_location (char *args, char **addr_string,
char **excep_string,
- struct breakpoint_ops **ops)
+ const struct breakpoint_ops **ops)
{
enum exception_catchpoint_kind ex;
@@ -11691,7 +11691,7 @@ create_ada_exception_catchpoint (struct gdbarch *gdbarch,
struct symtab_and_line sal,
char *addr_string,
char *excep_string,
- struct breakpoint_ops *ops,
+ const struct breakpoint_ops *ops,
int tempflag,
int from_tty)
{
@@ -11716,7 +11716,7 @@ catch_ada_exception_command (char *arg, int from_tty,
struct symtab_and_line sal;
char *addr_string = NULL;
char *excep_string = NULL;
- struct breakpoint_ops *ops = NULL;
+ const struct breakpoint_ops *ops = NULL;
tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
@@ -11729,7 +11729,7 @@ catch_ada_exception_command (char *arg, int from_tty,
static struct symtab_and_line
ada_decode_assert_location (char *args, char **addr_string,
- struct breakpoint_ops **ops)
+ const struct breakpoint_ops **ops)
{
/* Check that no argument where provided at the end of the command. */
@@ -11754,7 +11754,7 @@ catch_assert_command (char *arg, int from_tty,
int tempflag;
struct symtab_and_line sal;
char *addr_string = NULL;
- struct breakpoint_ops *ops = NULL;
+ const struct breakpoint_ops *ops = NULL;
tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 4f09d3a..5afda31 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -108,17 +108,18 @@ static void mention (struct breakpoint *);
static struct breakpoint *set_raw_breakpoint_without_location (struct gdbarch *,
enum bptype,
- struct breakpoint_ops *);
+ const struct breakpoint_ops *);
/* This function is used in gdbtk sources and thus can not be made
static. */
struct breakpoint *set_raw_breakpoint (struct gdbarch *gdbarch,
struct symtab_and_line,
- enum bptype, struct breakpoint_ops *);
+ enum bptype,
+ const struct breakpoint_ops *);
static struct breakpoint *
momentary_breakpoint_from_master (struct breakpoint *orig,
enum bptype type,
- struct breakpoint_ops *ops);
+ const struct breakpoint_ops *ops);
static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, int);
@@ -2110,7 +2111,7 @@ set_breakpoint_number (int internal, struct breakpoint *b)
static struct breakpoint *
create_internal_breakpoint (struct gdbarch *gdbarch,
CORE_ADDR address, enum bptype type,
- struct breakpoint_ops *ops)
+ const struct breakpoint_ops *ops)
{
struct symtab_and_line sal;
struct breakpoint *b;
@@ -5605,7 +5606,7 @@ static void
init_raw_breakpoint_without_location (struct breakpoint *b,
struct gdbarch *gdbarch,
enum bptype bptype,
- struct breakpoint_ops *ops)
+ const struct breakpoint_ops *ops)
{
memset (b, 0, sizeof (*b));
@@ -5634,7 +5635,7 @@ init_raw_breakpoint_without_location (struct breakpoint *b,
static struct breakpoint *
set_raw_breakpoint_without_location (struct gdbarch *gdbarch,
enum bptype bptype,
- struct breakpoint_ops *ops)
+ const struct breakpoint_ops *ops)
{
struct breakpoint *b = XNEW (struct breakpoint);
@@ -5711,7 +5712,7 @@ get_sal_arch (struct symtab_and_line sal)
static void
init_raw_breakpoint (struct breakpoint *b, struct gdbarch *gdbarch,
struct symtab_and_line sal, enum bptype bptype,
- struct breakpoint_ops *ops)
+ const struct breakpoint_ops *ops)
{
CORE_ADDR adjusted_address;
struct gdbarch *loc_gdbarch;
@@ -5775,7 +5776,7 @@ init_raw_breakpoint (struct breakpoint *b, struct gdbarch *gdbarch,
struct breakpoint *
set_raw_breakpoint (struct gdbarch *gdbarch,
struct symtab_and_line sal, enum bptype bptype,
- struct breakpoint_ops *ops)
+ const struct breakpoint_ops *ops)
{
struct breakpoint *b = XNEW (struct breakpoint);
@@ -6616,7 +6617,7 @@ static void
init_catchpoint (struct breakpoint *b,
struct gdbarch *gdbarch, int tempflag,
char *cond_string,
- struct breakpoint_ops *ops)
+ const struct breakpoint_ops *ops)
{
struct symtab_and_line sal;
@@ -6643,7 +6644,7 @@ install_breakpoint (int internal, struct breakpoint *b)
static void
create_fork_vfork_event_catchpoint (struct gdbarch *gdbarch,
int tempflag, char *cond_string,
- struct breakpoint_ops *ops)
+ const struct breakpoint_ops *ops)
{
struct fork_catchpoint *c = XNEW (struct fork_catchpoint);
@@ -6762,7 +6763,7 @@ static struct breakpoint_ops catch_exec_breakpoint_ops;
static void
create_syscall_event_catchpoint (int tempflag, VEC(int) *filter,
- struct breakpoint_ops *ops)
+ const struct breakpoint_ops *ops)
{
struct syscall_catchpoint *c;
struct gdbarch *gdbarch = get_current_arch ();
@@ -6942,7 +6943,7 @@ set_momentary_breakpoint (struct gdbarch *gdbarch, struct symtab_and_line sal,
static struct breakpoint *
momentary_breakpoint_from_master (struct breakpoint *orig,
enum bptype type,
- struct breakpoint_ops *ops)
+ const struct breakpoint_ops *ops)
{
struct breakpoint *copy;
@@ -7093,7 +7094,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
char *cond_string,
enum bptype type, enum bpdisp disposition,
int thread, int task, int ignore_count,
- struct breakpoint_ops *ops, int from_tty,
+ const struct breakpoint_ops *ops, int from_tty,
int enabled, int internal, int display_canonical)
{
int i;
@@ -7218,7 +7219,7 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
char *cond_string,
enum bptype type, enum bpdisp disposition,
int thread, int task, int ignore_count,
- struct breakpoint_ops *ops, int from_tty,
+ const struct breakpoint_ops *ops, int from_tty,
int enabled, int internal, int display_canonical)
{
struct breakpoint *b;
@@ -7402,7 +7403,7 @@ create_breakpoints_sal (struct gdbarch *gdbarch,
char *cond_string,
enum bptype type, enum bpdisp disposition,
int thread, int task, int ignore_count,
- struct breakpoint_ops *ops, int from_tty,
+ const struct breakpoint_ops *ops, int from_tty,
int enabled, int internal)
{
int i;
@@ -7682,7 +7683,7 @@ create_breakpoint (struct gdbarch *gdbarch,
int tempflag, enum bptype type_wanted,
int ignore_count,
enum auto_boolean pending_break_support,
- struct breakpoint_ops *ops,
+ const struct breakpoint_ops *ops,
int from_tty, int enabled, int internal)
{
volatile struct gdb_exception e;
@@ -9864,7 +9865,7 @@ init_ada_exception_breakpoint (struct breakpoint *b,
struct gdbarch *gdbarch,
struct symtab_and_line sal,
char *addr_string,
- struct breakpoint_ops *ops,
+ const struct breakpoint_ops *ops,
int tempflag,
int from_tty)
{
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 58e33d4..9b79e3e 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -533,7 +533,7 @@ extern int target_exact_watchpoints;
struct breakpoint
{
/* Methods associated with this breakpoint. */
- struct breakpoint_ops *ops;
+ const struct breakpoint_ops *ops;
struct breakpoint *next;
/* Type of breakpoint. */
@@ -1093,7 +1093,7 @@ extern void
struct gdbarch *gdbarch,
struct symtab_and_line sal,
char *addr_string,
- struct breakpoint_ops *ops,
+ const struct breakpoint_ops *ops,
int tempflag,
int from_tty);
@@ -1110,7 +1110,7 @@ extern int create_breakpoint (struct gdbarch *gdbarch, char *arg,
int tempflag, enum bptype wanted_type,
int ignore_count,
enum auto_boolean pending_break_support,
- struct breakpoint_ops *ops,
+ const struct breakpoint_ops *ops,
int from_tty,
int enabled,
int internal);
next prev parent reply other threads:[~2011-07-25 15:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-22 15:42 Pedro Alves
2011-07-22 17:33 ` Tom Tromey
2011-07-25 12:39 ` Pedro Alves
2011-07-25 16:20 ` Tom Tromey [this message]
2011-07-22 17:38 ` Phil Muldoon
2011-07-25 14:17 ` Pedro Alves
2011-07-25 14:40 ` Phil Muldoon
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=m37h76tl5x.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.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