[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haiku-commits
Subject:    [haiku-commits] [S] Change in haiku[master]: Debugger: implement parsing for v4 line-info
From:       Gerrit <review () review ! haiku-os ! org>
Date:       2023-08-30 12:08:37
Message-ID: 70dc8b1c260405e1c2739d838d5aeedba51b56df-HTML () review ! haiku-os ! org
[Download RAW message or body]

From David Karoly <karolyd577@gmail.com>:

David Karoly has uploaded this change for review. ( \
https://review.haiku-os.org/c/haiku/+/6876?usp=email )


Change subject: Debugger: implement parsing for v4 line-info
......................................................................

Debugger: implement parsing for v4 line-info

Differences between DWARF v3/v4 for line-info:
- added new field maxOpsPerInstruction
  this new field will typically have the value of 1
  unless VLIW architecture is being used
  (which is not the case for Haiku)
- state machine contains a new field op_index
  it has any relevance only when maxOpsPerInstruction > 1
  i.e. on VLIW architectures
- added new operation DW_LNE_set_discriminator
  this is already implemented in LineNumberProgram.cpp

This implementation just reads maxOpsPerInstruction and
checks that it is set to 1, which is what we expect on
all architectures currently supported by Haiku.
---
M src/kits/debugger/dwarf/DwarfFile.cpp
1 file changed, 37 insertions(+), 1 deletion(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/76/6876/1

diff --git a/src/kits/debugger/dwarf/DwarfFile.cpp \
b/src/kits/debugger/dwarf/DwarfFile.cpp index 5ccac82..15a7d8c 100644
--- a/src/kits/debugger/dwarf/DwarfFile.cpp
+++ b/src/kits/debugger/dwarf/DwarfFile.cpp
@@ -1779,7 +1779,7 @@
 	// version (uhalf)
 	uint16 version = dataReader.Read<uint16>(0);

-	if (version != 2 && version != 3) {
+	if (version != 2 && version != 3 && version != 4) {
 		WARNING("DwarfFile::_ParseLineInfo(\"%s\"): unsupported "
 			"version %d\n", fName, version);
 		return B_UNSUPPORTED;
@@ -1796,6 +1796,18 @@
 	// minimum instruction length
 	uint8 minInstructionLength = dataReader.Read<uint8>(0);

+	uint8 maxOpsPerInstruction;
+	if (version >= 4)
+		maxOpsPerInstruction = dataReader.Read<uint8>(0);
+	else
+		maxOpsPerInstruction = 1;
+
+	if (maxOpsPerInstruction != 1) {
+		WARNING("DwarfFile::_ParseLineInfo(\"%s\"): unsupported "
+			"maxOpsPerInstruction %u\n", fName, maxOpsPerInstruction);
+		return B_UNSUPPORTED;
+	}
+
 	// default is statement
 	bool defaultIsStatement = dataReader.Read<uint8>(0) != 0;

@@ -1819,6 +1831,8 @@
 	TRACE_LINES("  version:              %u\n", version);
 	TRACE_LINES("  headerLength:         %" B_PRIu64 "\n", headerLength);
 	TRACE_LINES("  minInstructionLength: %u\n", minInstructionLength);
+	if (version >= 4)
+		TRACE_LINES("  maxOpsPerInstruction: %u\n", maxOpsPerInstruction);
 	TRACE_LINES("  defaultIsStatement:   %d\n", defaultIsStatement);
 	TRACE_LINES("  lineBase:             %d\n", lineBase);
 	TRACE_LINES("  lineRange:            %u\n", lineRange);

--
To view, visit https://review.haiku-os.org/c/haiku/+/6876?usp=email
To unsubscribe, or for help writing mail filters, visit \
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I14755d615a0e2b3a5177928c4d8f9014940a5fcf
Gerrit-Change-Number: 6876
Gerrit-PatchSet: 1
Gerrit-Owner: David Karoly <karolyd577@gmail.com>
Gerrit-MessageType: newchange


[Attachment #3 (text/html)]

<p>David Karoly has uploaded this change for <strong>review</strong>.</p><p><a \
href="https://review.haiku-os.org/c/haiku/+/6876?usp=email">View Change</a></p><pre \
style="font-family: monospace,monospace; white-space: pre-wrap;">Debugger: implement \
parsing for v4 line-info<br><br>Differences between DWARF v3/v4 for line-info:<br>- \
added new field maxOpsPerInstruction<br>  this new field will typically have the \
value of 1<br>  unless VLIW architecture is being used<br>  (which is not the case \
for Haiku)<br>- state machine contains a new field op_index<br>  it has any relevance \
only when maxOpsPerInstruction &gt; 1<br>  i.e. on VLIW architectures<br>- added new \
operation DW_LNE_set_discriminator<br>  this is already implemented in \
LineNumberProgram.cpp<br><br>This implementation just reads maxOpsPerInstruction \
and<br>checks that it is set to 1, which is what we expect on<br>all architectures \
currently supported by Haiku.<br>---<br>M src/kits/debugger/dwarf/DwarfFile.cpp<br>1 \
file changed, 37 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: \
monospace,monospace; white-space: pre-wrap;">git pull ssh://git.haiku-os.org:22/haiku \
refs/changes/76/6876/1</pre><pre style="font-family: monospace,monospace; \
white-space: pre-wrap;"><span>diff --git a/src/kits/debugger/dwarf/DwarfFile.cpp \
b/src/kits/debugger/dwarf/DwarfFile.cpp</span><br><span>index 5ccac82..15a7d8c \
100644</span><br><span>--- \
a/src/kits/debugger/dwarf/DwarfFile.cpp</span><br><span>+++ \
b/src/kits/debugger/dwarf/DwarfFile.cpp</span><br><span>@@ -1779,7 +1779,7 \
@@</span><br><span> 	// version (uhalf)</span><br><span> 	uint16 version = \
dataReader.Read&lt;uint16&gt;(0);</span><br><span> </span><br><span style="color: \
hsl(0, 100%, 40%);">-	if (version != 2 &amp;&amp; version != 3) {</span><br><span \
style="color: hsl(120, 100%, 40%);">+	if (version != 2 &amp;&amp; version != 3 \
&amp;&amp; version != 4) {</span><br><span> \
WARNING(&quot;DwarfFile::_ParseLineInfo(\&quot;%s\&quot;): unsupported \
&quot;</span><br><span> 			&quot;version %d\n&quot;, fName, \
version);</span><br><span> 		return B_UNSUPPORTED;</span><br><span>@@ -1796,6 \
+1796,18 @@</span><br><span> 	// minimum instruction length</span><br><span> 	uint8 \
minInstructionLength = dataReader.Read&lt;uint8&gt;(0);</span><br><span> \
</span><br><span style="color: hsl(120, 100%, 40%);">+	uint8 \
maxOpsPerInstruction;</span><br><span style="color: hsl(120, 100%, 40%);">+	if \
(version &gt;= 4)</span><br><span style="color: hsl(120, 100%, \
40%);">+		maxOpsPerInstruction = dataReader.Read&lt;uint8&gt;(0);</span><br><span \
style="color: hsl(120, 100%, 40%);">+	else</span><br><span style="color: hsl(120, \
100%, 40%);">+		maxOpsPerInstruction = 1;</span><br><span style="color: hsl(120, \
100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+	if \
(maxOpsPerInstruction != 1) {</span><br><span style="color: hsl(120, 100%, \
40%);">+		WARNING(&quot;DwarfFile::_ParseLineInfo(\&quot;%s\&quot;): unsupported \
&quot;</span><br><span style="color: hsl(120, 100%, \
40%);">+			&quot;maxOpsPerInstruction %u\n&quot;, fName, \
maxOpsPerInstruction);</span><br><span style="color: hsl(120, 100%, 40%);">+		return \
B_UNSUPPORTED;</span><br><span style="color: hsl(120, 100%, \
40%);">+	}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> 	// \
default is statement</span><br><span> 	bool defaultIsStatement = \
dataReader.Read&lt;uint8&gt;(0) != 0;</span><br><span> </span><br><span>@@ -1819,6 \
+1831,8 @@</span><br><span> 	TRACE_LINES(&quot;  version:              %u\n&quot;, \
version);</span><br><span> 	TRACE_LINES(&quot;  headerLength:         %&quot; \
B_PRIu64 &quot;\n&quot;, headerLength);</span><br><span> 	TRACE_LINES(&quot;  \
minInstructionLength: %u\n&quot;, minInstructionLength);</span><br><span \
style="color: hsl(120, 100%, 40%);">+	if (version &gt;= 4)</span><br><span \
style="color: hsl(120, 100%, 40%);">+		TRACE_LINES(&quot;  maxOpsPerInstruction: \
%u\n&quot;, maxOpsPerInstruction);</span><br><span> 	TRACE_LINES(&quot;  \
defaultIsStatement:   %d\n&quot;, defaultIsStatement);</span><br><span> \
TRACE_LINES(&quot;  lineBase:             %d\n&quot;, lineBase);</span><br><span> \
TRACE_LINES(&quot;  lineRange:            %u\n&quot;, \
lineRange);</span><br><span></span><br></pre><p>To view, visit <a \
href="https://review.haiku-os.org/c/haiku/+/6876?usp=email">change 6876</a>. To \
unsubscribe, or for help writing mail filters, visit <a \
href="https://review.haiku-os.org/settings">settings</a>.</p><div itemscope \
itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" \
itemtype="http://schema.org/ViewAction"><link itemprop="url" \
href="https://review.haiku-os.org/c/haiku/+/6876?usp=email"/><meta itemprop="name" \
content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: haiku </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: \
I14755d615a0e2b3a5177928c4d8f9014940a5fcf </div> <div style="display:none"> \
Gerrit-Change-Number: 6876 </div> <div style="display:none"> Gerrit-PatchSet: 1 \
</div> <div style="display:none"> Gerrit-Owner: David Karoly \
&lt;karolyd577@gmail.com&gt; </div> <div style="display:none"> Gerrit-MessageType: \
newchange </div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic