MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / resolve_string

Function resolve_string

Dependencies/tracy/libbacktrace/dwarf.cpp:1374–1424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1372 offset. */
1373
1374static int
1375resolve_string (const struct dwarf_sections *dwarf_sections, int is_dwarf64,
1376 int is_bigendian, uint64_t str_offsets_base,
1377 const struct attr_val *val,
1378 backtrace_error_callback error_callback, void *data,
1379 const char **string)
1380{
1381 switch (val->encoding)
1382 {
1383 case ATTR_VAL_STRING:
1384 *string = val->u.string;
1385 return 1;
1386
1387 case ATTR_VAL_STRING_INDEX:
1388 {
1389 uint64_t offset;
1390 struct dwarf_buf offset_buf;
1391
1392 offset = val->u.uint * (is_dwarf64 ? 8 : 4) + str_offsets_base;
1393 if (offset + (is_dwarf64 ? 8 : 4)
1394 > dwarf_sections->size[DEBUG_STR_OFFSETS])
1395 {
1396 error_callback (data, "DW_FORM_strx value out of range", 0);
1397 return 0;
1398 }
1399
1400 offset_buf.name = ".debug_str_offsets";
1401 offset_buf.start = dwarf_sections->data[DEBUG_STR_OFFSETS];
1402 offset_buf.buf = dwarf_sections->data[DEBUG_STR_OFFSETS] + offset;
1403 offset_buf.left = dwarf_sections->size[DEBUG_STR_OFFSETS] - offset;
1404 offset_buf.is_bigendian = is_bigendian;
1405 offset_buf.error_callback = error_callback;
1406 offset_buf.data = data;
1407 offset_buf.reported_underflow = 0;
1408
1409 offset = read_offset (&offset_buf, is_dwarf64);
1410 if (offset >= dwarf_sections->size[DEBUG_STR])
1411 {
1412 dwarf_buf_error (&offset_buf,
1413 "DW_FORM_strx offset out of range",
1414 0);
1415 return 0;
1416 }
1417 *string = (const char *) dwarf_sections->data[DEBUG_STR] + offset;
1418 return 1;
1419 }
1420
1421 default:
1422 return 1;
1423 }
1424}
1425
1426/* Set *ADDRESS to the real address for a ATTR_VAL_ADDRESS_INDEX.
1427 Return 1 on success, 0 on error. */

Callers 4

find_address_rangesFunction · 0.85
read_lnctFunction · 0.85
read_referenced_nameFunction · 0.85
read_function_entryFunction · 0.85

Calls 2

read_offsetFunction · 0.85
dwarf_buf_errorFunction · 0.85

Tested by

no test coverage detected