VirtualBox

source: vbox/trunk/src/VBox/VMM/dwarfdump-to-offsets.sed@ 105173

Last change on this file since 105173 was 104367, checked in by vboxsync, 8 months ago

VMM/IEM: Use IEMInternal.h from IEMAllN8veHlpA-arm64.S and produce member offsets for IEMCPU and VMCPU that can be used from same. bugref:10653 bugref:10370

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1# $Id: dwarfdump-to-offsets.sed 104367 2024-04-18 22:38:19Z vboxsync $
2## @file
3# For defining member offsets for selected struct so the ARM64 assembler can use them.
4#
5# The script ASSUMES that the input is well filtered and the the output doesn't
6# change in any way that makes it difficult to match and edit. The dwarfdump
7# utility assumed there, is the one from llvm that shippes with apple's command
8# line tools.
9#
10# These assumptions aren't ideal, however the two alternatives are:
11# 1. Build time program to print the offsets via RT_UOFFSETOF,
12# 2. Build time program parsing the dwarf info ourselves.
13#
14# The problem with the first option is that we have to get all the DEFS right
15# as well as the compiler options to ensure that we end up with the same
16# structure layout. Doesn't led itself for cross building either (not all that
17# relevant for darwin, but it probably is for linux).
18#
19# The second option is potentially a lot of work as we don't have any IPRT
20# interface for browsing types found in debug info yet. Once that is added, it
21# shouldn't be all that difficult.
22#
23
24#
25# Copyright (C) 2024 Oracle and/or its affiliates.
26#
27# This file is part of VirtualBox base platform packages, as
28# available from https://www.virtualbox.org.
29#
30# This program is free software; you can redistribute it and/or
31# modify it under the terms of the GNU General Public License
32# as published by the Free Software Foundation, in version 3 of the
33# License.
34#
35# This program is distributed in the hope that it will be useful, but
36# WITHOUT ANY WARRANTY; without even the implied warranty of
37# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
38# General Public License for more details.
39#
40# You should have received a copy of the GNU General Public License
41# along with this program; if not, see <https://www.gnu.org/licenses>.
42#
43# SPDX-License-Identifier: GPL-3.0-only
44#
45
46#
47# This matches first level structure types, putting the name in the hold space for later use.
48#
49# ASSUMES that the DW_AT_xxx listing follow on separate lines, one line per attribute
50# ASSUMES that there is a blank line after the DW_AT_xxx listing
51# ASSUMES that first level structures have exactly one space after the colon.
52#
53/^0x[[:xdigit:]][[:xdigit:]]*: DW_TAG_structure_type/,/^[[:space:]]*$/ {
54 /DW_AT_name/ {
55 s/^.*DW_AT_name[[:space:]]*[(]["]//
56 s/["][)][[:space:]]*$//
57 h
58 }
59 /DW_AT_data_member_location/p
60}
61
62
63
64#
65# This matches the first level of structure members.
66#
67# ASSUMES that the DW_AT_xxx listing follow on separate lines, one line per attribute
68# ASSUMES that there is a blank line after the DW_AT_xxx listing
69# ASSUMES that first level member have exactly three spaces after the colon.
70#
71/^0x[[:xdigit:]][[:xdigit:]]*: DW_TAG_member/,/^[[:space:]]*$/ {
72 /DW_AT_name/ {
73 s/^.*DW_AT_name[[:space:]]*[(]["]/_OFF_/
74 s/["][)][[:space:]]*$//
75 x
76 H
77 x
78 s/\(_OFF_.*\)[\n]\(.*\)$/#define \2\1 \\/
79 p
80 }
81 /DW_AT_data_member_location/ {
82 s/^[[:space:]]*DW_AT_data_member_location[[:space:]]*/ /
83 p
84 }
85}
86
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette