public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH obv] Darwin: Fix gdb compilation.
@ 2016-12-16 10:14 Bernhard Heckel
  2016-12-16 11:32 ` Pedro Alves
  0 siblings, 1 reply; 2+ messages in thread
From: Bernhard Heckel @ 2016-12-16 10:14 UTC (permalink / raw)
  To: gdb-patches; +Cc: Bernhard Heckel

Due to changes introduced by
commit 4d01a485d29732b19743e8b138897f3509e071b0
('struct expression *' -> gdb::unique_xmalloc_ptr<expression>)
compilation is broken on Darwin.

../gdb/darwin-nat-info.c:733:8: error: assigning to 'struct expression *'
from incompatible type
'expression_up' (aka 'std::__1::unique_ptr<expression, gdb::xfree_deleter<expression> >')
expr = parse_expression (exp);

2016-12-16  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Changelog:
	* darwin-nat-info.c (info_mach_region_command): Use expression_up.

---
 gdb/darwin-nat-info.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
index 314d265..0262026 100644
--- a/gdb/darwin-nat-info.c
+++ b/gdb/darwin-nat-info.c
@@ -725,13 +725,12 @@ info_mach_regions_recurse_command (char *args, int from_tty)
 static void
 info_mach_region_command (char *exp, int from_tty)
 {
-  struct expression *expr;
   struct value *val;
   mach_vm_address_t address;
   struct inferior *inf;
 
-  expr = parse_expression (exp);
-  val = evaluate_expression (expr);
+  expression_up expr = parse_expression (exp);
+  val = evaluate_expression (expr.get ());
   if (TYPE_CODE (value_type (val)) == TYPE_CODE_REF)
     {
       val = value_ind (val);
-- 
2.7.1.339.g0233b80

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

* Re: [PATCH obv] Darwin: Fix gdb compilation.
  2016-12-16 10:14 [PATCH obv] Darwin: Fix gdb compilation Bernhard Heckel
@ 2016-12-16 11:32 ` Pedro Alves
  0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2016-12-16 11:32 UTC (permalink / raw)
  To: Bernhard Heckel, gdb-patches

On 12/16/2016 10:13 AM, Bernhard Heckel wrote:
> Due to changes introduced by
> commit 4d01a485d29732b19743e8b138897f3509e071b0
> ('struct expression *' -> gdb::unique_xmalloc_ptr<expression>)
> compilation is broken on Darwin.
> 
> ../gdb/darwin-nat-info.c:733:8: error: assigning to 'struct expression *'
> from incompatible type
> 'expression_up' (aka 'std::__1::unique_ptr<expression, gdb::xfree_deleter<expression> >')
> expr = parse_expression (exp);
> 
> 2016-12-16  Bernhard Heckel  <bernhard.heckel@intel.com>
> 
> gdb/Changelog:
> 	* darwin-nat-info.c (info_mach_region_command): Use expression_up.

OK, please push if you haven't yet.

>  static void
>  info_mach_region_command (char *exp, int from_tty)
>  {
> -  struct expression *expr;
>    struct value *val;
>    mach_vm_address_t address;
>    struct inferior *inf;
>  
> -  expr = parse_expression (exp);
> -  val = evaluate_expression (expr);
> +  expression_up expr = parse_expression (exp);
> +  val = evaluate_expression (expr.get ());
>    if (TYPE_CODE (value_type (val)) == TYPE_CODE_REF)
>      {
>        val = value_ind (val);
> 

Note this fixes a leak as well -- nothing was deleting exp before.

Thanks,
Pedro Alves

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

end of thread, other threads:[~2016-12-16 11:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-16 10:14 [PATCH obv] Darwin: Fix gdb compilation Bernhard Heckel
2016-12-16 11:32 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).