gas/
[deliverable/binutils-gdb.git] / gdb / dwarf2loc.c
CommitLineData
4c2df51b 1/* DWARF 2 location expression support for GDB.
feb13ab0 2
9b254dd1 3 Copyright (C) 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
feb13ab0 4
4c2df51b
DJ
5 Contributed by Daniel Jacobowitz, MontaVista Software, Inc.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
a9762ec7
JB
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
4c2df51b 13
a9762ec7
JB
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
4c2df51b
DJ
18
19 You should have received a copy of the GNU General Public License
a9762ec7 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
4c2df51b
DJ
21
22#include "defs.h"
23#include "ui-out.h"
24#include "value.h"
25#include "frame.h"
26#include "gdbcore.h"
27#include "target.h"
28#include "inferior.h"
a55cc764
DJ
29#include "ax.h"
30#include "ax-gdb.h"
e4adbba9 31#include "regcache.h"
c3228f12 32#include "objfiles.h"
93ad78a7 33#include "exceptions.h"
4c2df51b
DJ
34
35#include "elf/dwarf2.h"
36#include "dwarf2expr.h"
37#include "dwarf2loc.h"
38
39#include "gdb_string.h"
eff4f95e 40#include "gdb_assert.h"
4c2df51b 41
0d53c4c4
DJ
42/* A helper function for dealing with location lists. Given a
43 symbol baton (BATON) and a pc value (PC), find the appropriate
44 location expression, set *LOCEXPR_LENGTH, and return a pointer
45 to the beginning of the expression. Returns NULL on failure.
46
47 For now, only return the first matching location expression; there
48 can be more than one in the list. */
49
852483bc 50static gdb_byte *
0d53c4c4 51find_location_expression (struct dwarf2_loclist_baton *baton,
b6b08ebf 52 size_t *locexpr_length, CORE_ADDR pc)
0d53c4c4 53{
0d53c4c4 54 CORE_ADDR low, high;
852483bc
MK
55 gdb_byte *loc_ptr, *buf_end;
56 int length;
ae0d2f24
UW
57 struct objfile *objfile = dwarf2_per_cu_objfile (baton->per_cu);
58 unsigned int addr_size = dwarf2_per_cu_addr_size (baton->per_cu);
0d53c4c4 59 CORE_ADDR base_mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
8edfa926 60 /* Adjust base_address for relocatable objects. */
ae0d2f24
UW
61 CORE_ADDR base_offset = ANOFFSET (objfile->section_offsets,
62 SECT_OFF_TEXT (objfile));
8edfa926 63 CORE_ADDR base_address = baton->base_address + base_offset;
0d53c4c4
DJ
64
65 loc_ptr = baton->data;
66 buf_end = baton->data + baton->size;
67
68 while (1)
69 {
ae0d2f24
UW
70 low = dwarf2_read_address (loc_ptr, buf_end, addr_size);
71 loc_ptr += addr_size;
72 high = dwarf2_read_address (loc_ptr, buf_end, addr_size);
73 loc_ptr += addr_size;
0d53c4c4
DJ
74
75 /* An end-of-list entry. */
76 if (low == 0 && high == 0)
77 return NULL;
78
79 /* A base-address-selection entry. */
80 if ((low & base_mask) == base_mask)
81 {
82 base_address = high;
83 continue;
84 }
85
86 /* Otherwise, a location expression entry. */
87 low += base_address;
88 high += base_address;
89
90 length = extract_unsigned_integer (loc_ptr, 2);
91 loc_ptr += 2;
92
93 if (pc >= low && pc < high)
94 {
95 *locexpr_length = length;
96 return loc_ptr;
97 }
98
99 loc_ptr += length;
100 }
101}
102
4c2df51b
DJ
103/* This is the baton used when performing dwarf2 expression
104 evaluation. */
105struct dwarf_expr_baton
106{
107 struct frame_info *frame;
108 struct objfile *objfile;
109};
110
111/* Helper functions for dwarf2_evaluate_loc_desc. */
112
4bc9efe1 113/* Using the frame specified in BATON, return the value of register
0b2b0195 114 REGNUM, treated as a pointer. */
4c2df51b 115static CORE_ADDR
61fbb938 116dwarf_expr_read_reg (void *baton, int dwarf_regnum)
4c2df51b 117{
4c2df51b 118 struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
5e2b427d 119 struct gdbarch *gdbarch = get_frame_arch (debaton->frame);
e5192dd8 120 CORE_ADDR result;
0b2b0195 121 int regnum;
e4adbba9 122
5e2b427d
UW
123 regnum = gdbarch_dwarf2_reg_to_regnum (gdbarch, dwarf_regnum);
124 result = address_from_register (builtin_type (gdbarch)->builtin_data_ptr,
0b2b0195 125 regnum, debaton->frame);
4c2df51b
DJ
126 return result;
127}
128
129/* Read memory at ADDR (length LEN) into BUF. */
130
131static void
852483bc 132dwarf_expr_read_mem (void *baton, gdb_byte *buf, CORE_ADDR addr, size_t len)
4c2df51b
DJ
133{
134 read_memory (addr, buf, len);
135}
136
137/* Using the frame specified in BATON, find the location expression
138 describing the frame base. Return a pointer to it in START and
139 its length in LENGTH. */
140static void
852483bc 141dwarf_expr_frame_base (void *baton, gdb_byte **start, size_t * length)
4c2df51b 142{
da62e633
AC
143 /* FIXME: cagney/2003-03-26: This code should be using
144 get_frame_base_address(), and then implement a dwarf2 specific
145 this_base method. */
4c2df51b 146 struct symbol *framefunc;
4c2df51b 147 struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
0d53c4c4 148
4c2df51b 149 framefunc = get_frame_function (debaton->frame);
0d53c4c4 150
eff4f95e
JG
151 /* If we found a frame-relative symbol then it was certainly within
152 some function associated with a frame. If we can't find the frame,
153 something has gone wrong. */
154 gdb_assert (framefunc != NULL);
155
a67af2b9 156 if (SYMBOL_OPS (framefunc) == &dwarf2_loclist_funcs)
0d53c4c4
DJ
157 {
158 struct dwarf2_loclist_baton *symbaton;
22c6caba
JW
159 struct frame_info *frame = debaton->frame;
160
0d53c4c4
DJ
161 symbaton = SYMBOL_LOCATION_BATON (framefunc);
162 *start = find_location_expression (symbaton, length,
22c6caba 163 get_frame_address_in_block (frame));
0d53c4c4
DJ
164 }
165 else
166 {
167 struct dwarf2_locexpr_baton *symbaton;
168 symbaton = SYMBOL_LOCATION_BATON (framefunc);
169 *length = symbaton->size;
170 *start = symbaton->data;
171 }
172
173 if (*start == NULL)
8a3fe4f8 174 error (_("Could not find the frame base for \"%s\"."),
0d53c4c4 175 SYMBOL_NATURAL_NAME (framefunc));
4c2df51b
DJ
176}
177
178/* Using the objfile specified in BATON, find the address for the
179 current thread's thread-local storage with offset OFFSET. */
180static CORE_ADDR
181dwarf_expr_tls_address (void *baton, CORE_ADDR offset)
182{
183 struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
4c2df51b 184
9e35dae4 185 return target_translate_tls_address (debaton->objfile, offset);
4c2df51b
DJ
186}
187
188/* Evaluate a location description, starting at DATA and with length
189 SIZE, to find the current location of variable VAR in the context
190 of FRAME. */
191static struct value *
192dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
852483bc 193 gdb_byte *data, unsigned short size,
ae0d2f24 194 struct dwarf2_per_cu_data *per_cu)
4c2df51b 195{
87808bd6 196 struct gdbarch *arch = get_frame_arch (frame);
4c2df51b
DJ
197 struct value *retval;
198 struct dwarf_expr_baton baton;
199 struct dwarf_expr_context *ctx;
200
0d53c4c4
DJ
201 if (size == 0)
202 {
203 retval = allocate_value (SYMBOL_TYPE (var));
204 VALUE_LVAL (retval) = not_lval;
feb13ab0 205 set_value_optimized_out (retval, 1);
10fb19b6 206 return retval;
0d53c4c4
DJ
207 }
208
4c2df51b 209 baton.frame = frame;
ae0d2f24 210 baton.objfile = dwarf2_per_cu_objfile (per_cu);
4c2df51b
DJ
211
212 ctx = new_dwarf_expr_context ();
ae0d2f24 213 ctx->addr_size = dwarf2_per_cu_addr_size (per_cu);
4c2df51b
DJ
214 ctx->baton = &baton;
215 ctx->read_reg = dwarf_expr_read_reg;
216 ctx->read_mem = dwarf_expr_read_mem;
217 ctx->get_frame_base = dwarf_expr_frame_base;
218 ctx->get_tls_address = dwarf_expr_tls_address;
219
220 dwarf_expr_eval (ctx, data, size);
87808bd6
JB
221 if (ctx->num_pieces > 0)
222 {
23572eca
EZ
223 int i;
224 long offset = 0;
225 bfd_byte *contents;
226
227 retval = allocate_value (SYMBOL_TYPE (var));
228 contents = value_contents_raw (retval);
229 for (i = 0; i < ctx->num_pieces; i++)
230 {
231 struct dwarf_expr_piece *p = &ctx->pieces[i];
232 if (p->in_reg)
233 {
234 bfd_byte regval[MAX_REGISTER_SIZE];
055d23b8 235 int gdb_regnum = gdbarch_dwarf2_reg_to_regnum
ad010def 236 (arch, p->value);
23572eca
EZ
237 get_frame_register (frame, gdb_regnum, regval);
238 memcpy (contents + offset, regval, p->size);
239 }
240 else /* In memory? */
241 {
242 read_memory (p->value, contents + offset, p->size);
243 }
244 offset += p->size;
245 }
87808bd6
JB
246 }
247 else if (ctx->in_reg)
051caad9 248 {
5ca2e327 249 CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0);
055d23b8 250 int gdb_regnum = gdbarch_dwarf2_reg_to_regnum
ad010def 251 (arch, dwarf_regnum);
5ca2e327 252 retval = value_from_register (SYMBOL_TYPE (var), gdb_regnum, frame);
051caad9 253 }
4c2df51b
DJ
254 else
255 {
5ca2e327
JB
256 CORE_ADDR address = dwarf_expr_fetch (ctx, 0);
257
61fbb938 258 retval = allocate_value (SYMBOL_TYPE (var));
4c2df51b 259 VALUE_LVAL (retval) = lval_memory;
dfa52d88 260 set_value_lazy (retval, 1);
5ca2e327 261 VALUE_ADDRESS (retval) = address;
4c2df51b
DJ
262 }
263
42be36b3
CT
264 set_value_initialized (retval, ctx->initialized);
265
4c2df51b
DJ
266 free_dwarf_expr_context (ctx);
267
268 return retval;
269}
270
271
272
273
274\f
275/* Helper functions and baton for dwarf2_loc_desc_needs_frame. */
276
277struct needs_frame_baton
278{
279 int needs_frame;
280};
281
282/* Reads from registers do require a frame. */
283static CORE_ADDR
61fbb938 284needs_frame_read_reg (void *baton, int regnum)
4c2df51b
DJ
285{
286 struct needs_frame_baton *nf_baton = baton;
287 nf_baton->needs_frame = 1;
288 return 1;
289}
290
291/* Reads from memory do not require a frame. */
292static void
852483bc 293needs_frame_read_mem (void *baton, gdb_byte *buf, CORE_ADDR addr, size_t len)
4c2df51b
DJ
294{
295 memset (buf, 0, len);
296}
297
298/* Frame-relative accesses do require a frame. */
299static void
852483bc 300needs_frame_frame_base (void *baton, gdb_byte **start, size_t * length)
4c2df51b 301{
852483bc 302 static gdb_byte lit0 = DW_OP_lit0;
4c2df51b
DJ
303 struct needs_frame_baton *nf_baton = baton;
304
305 *start = &lit0;
306 *length = 1;
307
308 nf_baton->needs_frame = 1;
309}
310
311/* Thread-local accesses do require a frame. */
312static CORE_ADDR
313needs_frame_tls_address (void *baton, CORE_ADDR offset)
314{
315 struct needs_frame_baton *nf_baton = baton;
316 nf_baton->needs_frame = 1;
317 return 1;
318}
319
320/* Return non-zero iff the location expression at DATA (length SIZE)
321 requires a frame to evaluate. */
322
323static int
ae0d2f24
UW
324dwarf2_loc_desc_needs_frame (gdb_byte *data, unsigned short size,
325 struct dwarf2_per_cu_data *per_cu)
4c2df51b
DJ
326{
327 struct needs_frame_baton baton;
328 struct dwarf_expr_context *ctx;
f630a401 329 int in_reg;
4c2df51b
DJ
330
331 baton.needs_frame = 0;
332
333 ctx = new_dwarf_expr_context ();
ae0d2f24 334 ctx->addr_size = dwarf2_per_cu_addr_size (per_cu);
4c2df51b
DJ
335 ctx->baton = &baton;
336 ctx->read_reg = needs_frame_read_reg;
337 ctx->read_mem = needs_frame_read_mem;
338 ctx->get_frame_base = needs_frame_frame_base;
339 ctx->get_tls_address = needs_frame_tls_address;
340
341 dwarf_expr_eval (ctx, data, size);
342
f630a401
DJ
343 in_reg = ctx->in_reg;
344
87808bd6
JB
345 if (ctx->num_pieces > 0)
346 {
347 int i;
348
349 /* If the location has several pieces, and any of them are in
350 registers, then we will need a frame to fetch them from. */
351 for (i = 0; i < ctx->num_pieces; i++)
352 if (ctx->pieces[i].in_reg)
353 in_reg = 1;
354 }
355
4c2df51b
DJ
356 free_dwarf_expr_context (ctx);
357
f630a401 358 return baton.needs_frame || in_reg;
4c2df51b
DJ
359}
360
0d53c4c4 361static void
852483bc
MK
362dwarf2_tracepoint_var_ref (struct symbol *symbol, struct agent_expr *ax,
363 struct axs_value *value, gdb_byte *data,
0d53c4c4
DJ
364 int size)
365{
366 if (size == 0)
8a3fe4f8 367 error (_("Symbol \"%s\" has been optimized out."),
0d53c4c4
DJ
368 SYMBOL_PRINT_NAME (symbol));
369
370 if (size == 1
371 && data[0] >= DW_OP_reg0
372 && data[0] <= DW_OP_reg31)
373 {
374 value->kind = axs_lvalue_register;
375 value->u.reg = data[0] - DW_OP_reg0;
376 }
377 else if (data[0] == DW_OP_regx)
378 {
379 ULONGEST reg;
380 read_uleb128 (data + 1, data + size, &reg);
381 value->kind = axs_lvalue_register;
382 value->u.reg = reg;
383 }
384 else if (data[0] == DW_OP_fbreg)
385 {
386 /* And this is worse than just minimal; we should honor the frame base
387 as above. */
388 int frame_reg;
389 LONGEST frame_offset;
852483bc 390 gdb_byte *buf_end;
0d53c4c4
DJ
391
392 buf_end = read_sleb128 (data + 1, data + size, &frame_offset);
393 if (buf_end != data + size)
8a3fe4f8 394 error (_("Unexpected opcode after DW_OP_fbreg for symbol \"%s\"."),
0d53c4c4 395 SYMBOL_PRINT_NAME (symbol));
4c2df51b 396
c7bb205c
UW
397 gdbarch_virtual_frame_pointer (current_gdbarch,
398 ax->scope, &frame_reg, &frame_offset);
0d53c4c4
DJ
399 ax_reg (ax, frame_reg);
400 ax_const_l (ax, frame_offset);
401 ax_simple (ax, aop_add);
4c2df51b 402
9c238357
RC
403 value->kind = axs_lvalue_memory;
404 }
405 else if (data[0] >= DW_OP_breg0
406 && data[0] <= DW_OP_breg31)
407 {
408 unsigned int reg;
409 LONGEST offset;
410 gdb_byte *buf_end;
411
412 reg = data[0] - DW_OP_breg0;
413 buf_end = read_sleb128 (data + 1, data + size, &offset);
414 if (buf_end != data + size)
415 error (_("Unexpected opcode after DW_OP_breg%u for symbol \"%s\"."),
416 reg, SYMBOL_PRINT_NAME (symbol));
417
418 ax_reg (ax, reg);
419 ax_const_l (ax, offset);
0d53c4c4 420 ax_simple (ax, aop_add);
9c238357 421
0d53c4c4
DJ
422 value->kind = axs_lvalue_memory;
423 }
424 else
9c238357
RC
425 error (_("Unsupported DWARF opcode 0x%x in the location of \"%s\"."),
426 data[0], SYMBOL_PRINT_NAME (symbol));
0d53c4c4 427}
4c2df51b
DJ
428\f
429/* Return the value of SYMBOL in FRAME using the DWARF-2 expression
430 evaluator to calculate the location. */
431static struct value *
432locexpr_read_variable (struct symbol *symbol, struct frame_info *frame)
433{
434 struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
435 struct value *val;
436 val = dwarf2_evaluate_loc_desc (symbol, frame, dlbaton->data, dlbaton->size,
ae0d2f24 437 dlbaton->per_cu);
4c2df51b
DJ
438
439 return val;
440}
441
442/* Return non-zero iff we need a frame to evaluate SYMBOL. */
443static int
444locexpr_read_needs_frame (struct symbol *symbol)
445{
446 struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
ae0d2f24
UW
447 return dwarf2_loc_desc_needs_frame (dlbaton->data, dlbaton->size,
448 dlbaton->per_cu);
4c2df51b
DJ
449}
450
451/* Print a natural-language description of SYMBOL to STREAM. */
452static int
453locexpr_describe_location (struct symbol *symbol, struct ui_file *stream)
454{
455 /* FIXME: be more extensive. */
456 struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
ae0d2f24 457 int addr_size = dwarf2_per_cu_addr_size (dlbaton->per_cu);
4c2df51b
DJ
458
459 if (dlbaton->size == 1
460 && dlbaton->data[0] >= DW_OP_reg0
461 && dlbaton->data[0] <= DW_OP_reg31)
462 {
5e2b427d
UW
463 struct objfile *objfile = dwarf2_per_cu_objfile (dlbaton->per_cu);
464 struct gdbarch *gdbarch = get_objfile_arch (objfile);
465 int regno = gdbarch_dwarf2_reg_to_regnum (gdbarch,
466 dlbaton->data[0] - DW_OP_reg0);
4c2df51b 467 fprintf_filtered (stream,
c9f4d572 468 "a variable in register %s",
5e2b427d 469 gdbarch_register_name (gdbarch, regno));
4c2df51b
DJ
470 return 1;
471 }
472
c3228f12
EZ
473 /* The location expression for a TLS variable looks like this (on a
474 64-bit LE machine):
475
476 DW_AT_location : 10 byte block: 3 4 0 0 0 0 0 0 0 e0
477 (DW_OP_addr: 4; DW_OP_GNU_push_tls_address)
478
479 0x3 is the encoding for DW_OP_addr, which has an operand as long
480 as the size of an address on the target machine (here is 8
481 bytes). 0xe0 is the encoding for DW_OP_GNU_push_tls_address.
482 The operand represents the offset at which the variable is within
483 the thread local storage. */
484
485 if (dlbaton->size > 1
486 && dlbaton->data[dlbaton->size - 1] == DW_OP_GNU_push_tls_address)
487 if (dlbaton->data[0] == DW_OP_addr)
488 {
ae0d2f24 489 struct objfile *objfile = dwarf2_per_cu_objfile (dlbaton->per_cu);
c3228f12 490 CORE_ADDR offset = dwarf2_read_address (&dlbaton->data[1],
c193f044 491 &dlbaton->data[dlbaton->size - 1],
ae0d2f24 492 addr_size);
c3228f12 493 fprintf_filtered (stream,
32ffcbed 494 "a thread-local variable at offset %s in the "
c3228f12 495 "thread-local storage for `%s'",
ae0d2f24 496 paddr_nz (offset), objfile->name);
c3228f12
EZ
497 return 1;
498 }
499
500
4c2df51b
DJ
501 fprintf_filtered (stream,
502 "a variable with complex or multiple locations (DWARF2)");
503 return 1;
504}
505
a55cc764
DJ
506
507/* Describe the location of SYMBOL as an agent value in VALUE, generating
508 any necessary bytecode in AX.
509
510 NOTE drow/2003-02-26: This function is extremely minimal, because
511 doing it correctly is extremely complicated and there is no
512 publicly available stub with tracepoint support for me to test
513 against. When there is one this function should be revisited. */
514
0d53c4c4 515static void
a55cc764
DJ
516locexpr_tracepoint_var_ref (struct symbol * symbol, struct agent_expr * ax,
517 struct axs_value * value)
518{
519 struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
520
0d53c4c4 521 dwarf2_tracepoint_var_ref (symbol, ax, value, dlbaton->data, dlbaton->size);
a55cc764
DJ
522}
523
4c2df51b
DJ
524/* The set of location functions used with the DWARF-2 expression
525 evaluator. */
a67af2b9 526const struct symbol_ops dwarf2_locexpr_funcs = {
4c2df51b
DJ
527 locexpr_read_variable,
528 locexpr_read_needs_frame,
529 locexpr_describe_location,
a55cc764 530 locexpr_tracepoint_var_ref
4c2df51b 531};
0d53c4c4
DJ
532
533
534/* Wrapper functions for location lists. These generally find
535 the appropriate location expression and call something above. */
536
537/* Return the value of SYMBOL in FRAME using the DWARF-2 expression
538 evaluator to calculate the location. */
539static struct value *
540loclist_read_variable (struct symbol *symbol, struct frame_info *frame)
541{
542 struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
543 struct value *val;
852483bc 544 gdb_byte *data;
b6b08ebf 545 size_t size;
0d53c4c4
DJ
546
547 data = find_location_expression (dlbaton, &size,
22c6caba
JW
548 frame ? get_frame_address_in_block (frame)
549 : 0);
0d53c4c4 550 if (data == NULL)
806048c6
DJ
551 {
552 val = allocate_value (SYMBOL_TYPE (symbol));
553 VALUE_LVAL (val) = not_lval;
554 set_value_optimized_out (val, 1);
555 }
556 else
557 val = dwarf2_evaluate_loc_desc (symbol, frame, data, size,
ae0d2f24 558 dlbaton->per_cu);
0d53c4c4
DJ
559
560 return val;
561}
562
563/* Return non-zero iff we need a frame to evaluate SYMBOL. */
564static int
565loclist_read_needs_frame (struct symbol *symbol)
566{
567 /* If there's a location list, then assume we need to have a frame
568 to choose the appropriate location expression. With tracking of
569 global variables this is not necessarily true, but such tracking
570 is disabled in GCC at the moment until we figure out how to
571 represent it. */
572
573 return 1;
574}
575
576/* Print a natural-language description of SYMBOL to STREAM. */
577static int
578loclist_describe_location (struct symbol *symbol, struct ui_file *stream)
579{
580 /* FIXME: Could print the entire list of locations. */
581 fprintf_filtered (stream, "a variable with multiple locations");
582 return 1;
583}
584
585/* Describe the location of SYMBOL as an agent value in VALUE, generating
586 any necessary bytecode in AX. */
587static void
588loclist_tracepoint_var_ref (struct symbol * symbol, struct agent_expr * ax,
589 struct axs_value * value)
590{
591 struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
852483bc 592 gdb_byte *data;
b6b08ebf 593 size_t size;
0d53c4c4
DJ
594
595 data = find_location_expression (dlbaton, &size, ax->scope);
596 if (data == NULL)
8a3fe4f8 597 error (_("Variable \"%s\" is not available."), SYMBOL_NATURAL_NAME (symbol));
0d53c4c4
DJ
598
599 dwarf2_tracepoint_var_ref (symbol, ax, value, data, size);
600}
601
602/* The set of location functions used with the DWARF-2 expression
603 evaluator and location lists. */
a67af2b9 604const struct symbol_ops dwarf2_loclist_funcs = {
0d53c4c4
DJ
605 loclist_read_variable,
606 loclist_read_needs_frame,
607 loclist_describe_location,
608 loclist_tracepoint_var_ref
609};
This page took 0.360315 seconds and 4 git commands to generate.