From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org, Tom Tromey <tromey@redhat.com>
Cc: Stan Shebs <stan@codesourcery.com>, Jan Kratochvil <jkratoch@redhat.com>
Subject: collecting optimized out variables regression (Re: RFA: rewrite dwarf->ax translator (Was: RFC: implement DW_OP_bit_piece))
Date: Thu, 01 Jul 2010 12:43:00 -0000 [thread overview]
Message-ID: <201007011343.00392.pedro@codesourcery.com> (raw)
In-Reply-To: <m3ocfrzxia.fsf_-_@fleche.redhat.com>
Hi Tom,
After the rewrite, I'm seeing this:
(gdb) p m
$1 = <value optimized out>
(gdb) maint agent m
../../src/gdb/utils.c:1363: internal-error: virtual memory exhausted: can't allocate 562945039736192 bytes.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
#0 internal_error (file=0x7531ac "../../src/gdb/utils.c", line=1363,
string=0x753568 "virtual memory exhausted: can't allocate %ld bytes.") at ../../src/gdb/utils.c:1162
#1 0x0000000000417464 in nomem (size=562949953380224) at ../../src/gdb/utils.c:1363
#2 0x00000000004174c3 in xmalloc (size=562949953380224) at ../../src/gdb/utils.c:1394
#3 0x00000000005b1ac7 in compile_dwarf_to_ax (expr=0xebd020, loc=0x7fffffffd9b0, arch=0xcc9a20, addr_size=8,
op_ptr=0x0, op_end=0x7fffffffd7e0 " \320\353", per_cu=0xcada90) at ../../src/gdb/dwarf2loc.c:1220
#4 0x00000000005b4b78 in loclist_tracepoint_var_ref (symbol=0xd22c30, gdbarch=0xcc9a20, ax=0xebd020,
value=0x7fffffffd9b0) at ../../src/gdb/dwarf2loc.c:2572
#5 0x000000000048be46 in gen_var_ref (gdbarch=0xcc9a20, ax=0xebd020, value=0x7fffffffd9b0, var=0xd22c30)
at ../../src/gdb/ax-gdb.c:713
#6 0x000000000048e570 in gen_expr (exp=0xed5280, pc=0x7fffffffd9c8, ax=0xebd020, value=0x7fffffffd9b0)
at ../../src/gdb/ax-gdb.c:1962
#7 0x000000000048f92a in gen_trace_for_expr (scope=4197499, expr=0xed5280) at ../../src/gdb/ax-gdb.c:2387
#8 0x000000000048fabc in agent_command (exp=0xb4821c "m", from_tty=1) at ../../src/gdb/ax-gdb.c:2456
The xmalloc in question is this:
offsets = xmalloc ((op_end - op_ptr) * sizeof (int));
`op_end' and `op_ptr' are `data' and `data + size' in loclist_tracepoint_var_ref:
data = find_location_expression (dlbaton, &size, ax->scope);
compile_dwarf_to_ax (ax, value, gdbarch, addr_size, data, data + size,
dlbaton->per_cu);
where:
(top-gdb) p data
$1 = (const gdb_byte *) 0x0
(top-gdb) p size
$2 = 140737488345056
(top-gdb) p /x
$3 = 0x7fffffffd7e0
whoops.
On Thursday 03 June 2010 21:12:13, Tom Tromey wrote:
> (dwarf2_tracepoint_var_ref): Likewise.
> (locexpr_tracepoint_var_ref): Use compile_dwarf_to_ax.
> (loclist_tracepoint_var_ref): Likewise.
> -static void
> -dwarf2_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
> - struct agent_expr *ax, struct axs_value *value,
> - const gdb_byte *data, int size)
> -{
(...)
> -
> - if (!data || size == 0)
> - {
> - value->optimized_out = 1;
> - return;
> - }
Apparently, this bit was lost with the rewrite.
(...)
> @@ -1813,9 +2269,10 @@ locexpr_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
> struct agent_expr *ax, struct axs_value *value)
> {
> struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
> + unsigned int addr_size = dwarf2_per_cu_addr_size (dlbaton->per_cu);
>
> - dwarf2_tracepoint_var_ref (symbol, gdbarch, ax, value,
> - dlbaton->data, dlbaton->size);
> + compile_dwarf_to_ax (ax, value, gdbarch, addr_size,
> + dlbaton->data, dlbaton->data + dlbaton->size);
> }
>
> /* The set of location functions used with the DWARF-2 expression
> @@ -1957,10 +2414,11 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
> struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
> const gdb_byte *data;
> size_t size;
> + unsigned int addr_size = dwarf2_per_cu_addr_size (dlbaton->per_cu);
>
> data = find_location_expression (dlbaton, &size, ax->scope);
>
> - dwarf2_tracepoint_var_ref (symbol, gdbarch, ax, value, data, size);
> + compile_dwarf_to_ax (ax, value, gdbarch, addr_size, data, data + size);
> }
This patch fixes it for me. Is this the correct approach, or maybe there
was intent to handle this differently?
--
Pedro Alves
2010-07-01 Pedro Alves <pedro@codesourcery.com>
* dwarf2loc.c (locexpr_tracepoint_var_ref)
(loclist_tracepoint_var_ref): Handle optimized out values.
---
gdb/dwarf2loc.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
Index: src/gdb/dwarf2loc.c
===================================================================
--- src.orig/gdb/dwarf2loc.c 2010-07-01 12:19:35.000000000 +0100
+++ src/gdb/dwarf2loc.c 2010-07-01 13:32:38.000000000 +0100
@@ -2416,9 +2416,12 @@ locexpr_tracepoint_var_ref (struct symbo
struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
unsigned int addr_size = dwarf2_per_cu_addr_size (dlbaton->per_cu);
- compile_dwarf_to_ax (ax, value, gdbarch, addr_size,
- dlbaton->data, dlbaton->data + dlbaton->size,
- dlbaton->per_cu);
+ if (dlbaton->data == NULL || dlbaton->size == 0)
+ value->optimized_out = 1;
+ else
+ compile_dwarf_to_ax (ax, value, gdbarch, addr_size,
+ dlbaton->data, dlbaton->data + dlbaton->size,
+ dlbaton->per_cu);
}
/* The set of location functions used with the DWARF-2 expression
@@ -2568,9 +2571,11 @@ loclist_tracepoint_var_ref (struct symbo
unsigned int addr_size = dwarf2_per_cu_addr_size (dlbaton->per_cu);
data = find_location_expression (dlbaton, &size, ax->scope);
-
- compile_dwarf_to_ax (ax, value, gdbarch, addr_size, data, data + size,
- dlbaton->per_cu);
+ if (data == NULL || size == 0)
+ value->optimized_out = 1;
+ else
+ compile_dwarf_to_ax (ax, value, gdbarch, addr_size, data, data + size,
+ dlbaton->per_cu);
}
/* The set of location functions used with the DWARF-2 expression
next prev parent reply other threads:[~2010-07-01 12:43 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-18 23:43 RFC: implement DW_OP_bit_piece Tom Tromey
2010-05-19 14:16 ` Stan Shebs
2010-05-19 23:35 ` Tom Tromey
2010-05-20 3:29 ` Stan Shebs
2010-05-20 5:10 ` Tom Tromey
2010-05-20 7:12 ` Tom Tromey
2010-05-26 22:41 ` Tom Tromey
2010-06-03 20:12 ` RFA: rewrite dwarf->ax translator (Was: RFC: implement DW_OP_bit_piece) Tom Tromey
2010-06-08 20:45 ` RFA: rewrite dwarf->ax translator Tom Tromey
2010-06-11 15:20 ` Tom Tromey
2010-06-08 20:52 ` RFA: rewrite dwarf->ax translator (Was: RFC: implement DW_OP_bit_piece) Pedro Alves
2010-06-08 21:21 ` RFA: rewrite dwarf->ax translator Tom Tromey
2010-06-08 22:48 ` Tom Tromey
2010-06-09 14:04 ` Pedro Alves
2010-07-01 12:43 ` Pedro Alves [this message]
2010-07-01 15:25 ` collecting optimized out variables regression (Re: " Tom Tromey
2010-07-01 15:57 ` Pedro Alves
2010-07-01 15:34 ` collecting optimized out variables regression (Re: RFA: rewrite dwarf->ax translator (Was: RFC: implement DW_OP_bit_piece)) Jan Kratochvil
2010-05-20 19:53 ` RFC: implement DW_OP_bit_piece Tom Tromey
2010-05-20 20:30 ` Jan Kratochvil
2010-05-21 20:16 ` Tom Tromey
2010-05-21 21:16 ` Stan Shebs
2010-05-21 21:18 ` Tom Tromey
2010-05-25 19:22 ` RFC: DWARF expression disassembly (Was: RFC: implement DW_OP_bit_piece) Tom Tromey
2010-05-25 19:27 ` Jan Kratochvil
2010-05-25 20:25 ` RFC: DWARF expression disassembly Tom Tromey
2010-05-25 20:52 ` Jan Kratochvil
2010-05-25 22:03 ` Tom Tromey
2010-05-26 17:21 ` Eli Zaretskii
2010-06-01 18:36 ` Tom Tromey
2010-06-01 18:40 ` Eli Zaretskii
2010-06-02 19:32 ` Tom Tromey
2010-05-20 21:07 ` RFC: implement DW_OP_bit_piece Jan Kratochvil
2010-05-21 17:57 ` Tom Tromey
2010-05-25 18:19 ` performance talk [Re: RFC: implement DW_OP_bit_piece] Jan Kratochvil
2010-05-25 22:23 ` Tom Tromey
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=201007011343.00392.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=jkratoch@redhat.com \
--cc=stan@codesourcery.com \
--cc=tromey@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