Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Constify gen_printf/ax_string
@ 2013-03-06 19:57 Keith Seitz
  2013-03-06 20:11 ` Pedro Alves
  2013-03-06 21:51 ` Tom Tromey
  0 siblings, 2 replies; 6+ messages in thread
From: Keith Seitz @ 2013-03-06 19:57 UTC (permalink / raw)
  To: gdb-patches@sourceware.org ml

[-- Attachment #1: Type: text/plain, Size: 658 bytes --]

Hi,

As a follow-up to my "constify find_condition_and_thread" patch, which I 
am withdrawing, I will be submitting a patch to constify parse_exp_1. 
This patch is the only cleanup that I could split up off that (much 
larger) patch.

Even if that approach is not liked/desired by maintainers, this patch 
has its own merit IMO.

Tested by rebuilding (and testing on native-gdbserver, however fruitless 
that is on this type of patch).

Keith

ChangeLog
2013-03-06  Keith Seitz  <keiths@redhat.com>

	* ax-gdb.c (gen_printf): Make FORMAT const.
	* ax-gdb.h (gen_printf): Likewise.
	* ax-general.c (ax_string): Make STR const.
	* ax.h (ax_string): Likewise.


[-- Attachment #2: constify-ax_string-gen_printf.patch --]
[-- Type: text/x-patch, Size: 1826 bytes --]

diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 2029882..066826e 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2558,7 +2558,7 @@ gen_trace_for_return_address (CORE_ADDR scope, struct gdbarch *gdbarch)
 struct agent_expr *
 gen_printf (CORE_ADDR scope, struct gdbarch *gdbarch,
 	    CORE_ADDR function, LONGEST channel,
-	    char *format, int fmtlen,
+	    const char *format, int fmtlen,
 	    struct format_piece *frags,
 	    int nargs, struct expression **exprs)
 {
diff --git a/gdb/ax-gdb.h b/gdb/ax-gdb.h
index e74d107..04772b7 100644
--- a/gdb/ax-gdb.h
+++ b/gdb/ax-gdb.h
@@ -117,7 +117,7 @@ extern void require_rvalue (struct agent_expr *ax, struct axs_value *value);
 
 struct format_piece;
 extern struct agent_expr *gen_printf (CORE_ADDR, struct gdbarch *,
-				      CORE_ADDR, LONGEST, char *, int,
+				      CORE_ADDR, LONGEST, const char *, int,
 				      struct format_piece *,
 				      int, struct expression **);
 
diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index 32a47a7..8bd4df6 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -337,7 +337,7 @@ ax_tsv (struct agent_expr *x, enum agent_op op, int num)
    is counted in the length.)  */
 
 void
-ax_string (struct agent_expr *x, char *str, int slen)
+ax_string (struct agent_expr *x, const char *str, int slen)
 {
   int i;
 
diff --git a/gdb/ax.h b/gdb/ax.h
index 1c36125..32887ef 100644
--- a/gdb/ax.h
+++ b/gdb/ax.h
@@ -221,7 +221,7 @@ extern void ax_reg_mask (struct agent_expr *ax, int reg);
 extern void ax_tsv (struct agent_expr *expr, enum agent_op op, int num);
 
 /* Append a string to the bytecode stream.  */
-extern void ax_string (struct agent_expr *x, char *str, int slen);
+extern void ax_string (struct agent_expr *x, const char *str, int slen);
 \f
 
 /* Functions for printing out expressions, and otherwise debugging

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

* Re: [RFA] Constify gen_printf/ax_string
  2013-03-06 19:57 [RFA] Constify gen_printf/ax_string Keith Seitz
@ 2013-03-06 20:11 ` Pedro Alves
  2013-03-07  0:49   ` Keith Seitz
  2013-03-06 21:51 ` Tom Tromey
  1 sibling, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2013-03-06 20:11 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches@sourceware.org ml

On 03/06/2013 07:56 PM, Keith Seitz wrote:
> Hi,
> 
> As a follow-up to my "constify find_condition_and_thread" patch, which I am withdrawing, I will be submitting a patch to constify parse_exp_1. This patch is the only cleanup that I could split up off that (much larger) patch.
> 
> Even if that approach is not liked/desired by maintainers, this patch has its own merit IMO.

I can't begin to imagine how to object to this one.  :-)

> Tested by rebuilding (and testing on native-gdbserver, however fruitless that is on this type of patch).

> ChangeLog
> 2013-03-06  Keith Seitz  <keiths@redhat.com>
> 
>     * ax-gdb.c (gen_printf): Make FORMAT const.
>     * ax-gdb.h (gen_printf): Likewise.
>     * ax-general.c (ax_string): Make STR const.
>     * ax.h (ax_string): Likewise.

OK.

-- 
Pedro Alves


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

* Re: [RFA] Constify gen_printf/ax_string
  2013-03-06 19:57 [RFA] Constify gen_printf/ax_string Keith Seitz
  2013-03-06 20:11 ` Pedro Alves
@ 2013-03-06 21:51 ` Tom Tromey
  2013-03-06 21:57   ` Keith Seitz
  1 sibling, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2013-03-06 21:51 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches@sourceware.org ml

Keith> I will be submitting a patch to constify parse_exp_1.

Wow, that must've been a lot of work.

Keith> Even if that approach is not liked/desired by maintainers, this patch
Keith> has its own merit IMO.

I think making parse_exp_1 const-correct would be fantastic.

Tom


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

* Re: [RFA] Constify gen_printf/ax_string
  2013-03-06 21:51 ` Tom Tromey
@ 2013-03-06 21:57   ` Keith Seitz
  2013-03-07 15:04     ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Keith Seitz @ 2013-03-06 21:57 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches@sourceware.org ml

On 03/06/2013 01:50 PM, Tom Tromey wrote:
> Keith> I will be submitting a patch to constify parse_exp_1.
>
> Wow, that must've been a lot of work.

Well, not entirely. This is just the first round. All I did is xstrdup 
the input to parse_exp_1 and pass that *as is* to the subroutines. My 
plan is to keep pushing this down as much as possible as an attempt to 
get things going at least in a piecemeal/manageable way. YMMV.

I have a local branch here that I have modified the parsers and a bunch 
of other stuff, too. That patch is already quadruple the size of the 
this (as yet unsubmitted) patch. With that, there is still a phenomenal 
amount of work to do, but I will keep plugging away at it as time permits.

Keith


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

* Re: [RFA] Constify gen_printf/ax_string
  2013-03-06 20:11 ` Pedro Alves
@ 2013-03-07  0:49   ` Keith Seitz
  0 siblings, 0 replies; 6+ messages in thread
From: Keith Seitz @ 2013-03-07  0:49 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches@sourceware.org ml

On 03/06/2013 12:11 PM, Pedro Alves wrote:
> On 03/06/2013 07:56 PM, Keith Seitz wrote:
>> 2013-03-06  Keith Seitz  <keiths@redhat.com>
>>
>>      * ax-gdb.c (gen_printf): Make FORMAT const.
>>      * ax-gdb.h (gen_printf): Likewise.
>>      * ax-general.c (ax_string): Make STR const.
>>      * ax.h (ax_string): Likewise.
>
> OK.

Committed. Thank you for taking a look.

Keith



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

* Re: [RFA] Constify gen_printf/ax_string
  2013-03-06 21:57   ` Keith Seitz
@ 2013-03-07 15:04     ` Tom Tromey
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2013-03-07 15:04 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches@sourceware.org ml

Keith> Well, not entirely. This is just the first round. All I did is xstrdup
Keith> the input to parse_exp_1 and pass that *as is* to the subroutines. My
Keith> plan is to keep pushing this down as much as possible as an attempt to
Keith> get things going at least in a piecemeal/manageable way. YMMV.

Ok, not quite as huge as I'd imagined, but still it will be good to have.

Keith> I have a local branch here that I have modified the parsers and a
Keith> bunch of other stuff, too. That patch is already quadruple the size of
Keith> the this (as yet unsubmitted) patch. With that, there is still a
Keith> phenomenal amount of work to do, but I will keep plugging away at it
Keith> as time permits.

Super.

Tom


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

end of thread, other threads:[~2013-03-07 15:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-06 19:57 [RFA] Constify gen_printf/ax_string Keith Seitz
2013-03-06 20:11 ` Pedro Alves
2013-03-07  0:49   ` Keith Seitz
2013-03-06 21:51 ` Tom Tromey
2013-03-06 21:57   ` Keith Seitz
2013-03-07 15:04     ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox