Skip to content

Commit

Permalink
gdb-server: Expand arch-specific structure type every time
Browse files Browse the repository at this point in the history
As it is mentioned here [1] type's ID is unique name within containing
feature. That said if regs of the same type located in different features
it's required to insert type definition at least in each feature.

[1] https://sourceware.org/gdb/onlinedocs/gdb/Target-Description-Format.html#Types

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
  • Loading branch information
abrodkin committed May 7, 2019
1 parent ea2753a commit 2a5f512
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/gdb_server.c
Expand Up @@ -2012,7 +2012,7 @@ static int lookup_add_arch_defined_types(char const **arch_defined_types_list[],
return 1;
} else {
if (!strcmp((*arch_defined_types_list)[j], type_id))
return 0;
return 1;

This comment has been minimized.

Copy link
@sstallion

sstallion May 8, 2019

Is it the case there are multiple features presented? Would you mind posting a copy of the target description that's generated for the target in question?

This comment has been minimized.

Copy link
@abrodkin

abrodkin May 8, 2019

Author Member

Sure. The problem was in status32_t type (https://github.com/foss-for-synopsys-dwc-arc-processors/openocd/blob/master/tcl/cpu/arc/v2.tcl#L153) used for status32 (https://github.com/foss-for-synopsys-dwc-arc-processors/openocd/blob/master/tcl/cpu/arc/v2.tcl#L238) in org.gnu.gdb.arc.aux-minimal feature and erstatus (https://github.com/foss-for-synopsys-dwc-arc-processors/openocd/blob/master/tcl/cpu/arc/v2.tcl#L278) from org.gnu.gdb.arc.aux-other feature.

Do you know how to dump generated .xml from either OpenOCD or from GDB?
I debugged that with GDB dumping .xml to its stdout (set debug xml) but it's not very convenient to copy-paste pretty large .xml from console.

This comment has been minimized.

Copy link
@sstallion

sstallion May 8, 2019

I don't - in the past I've always looked at it using set debug remote.

Gotcha, it looks like ARC's GDB implementation relies on multiple features - there are several other targets that do this as well, though I'm not sure if those have duplicate types or not. The best advice I can give is to submit this upstream and tag borneo.antonio@gmail.com and matthias@welwarsky.de as reviewers to see what they think. I'm happy to be a reviewer as well if you'd like another set of eyes.

This comment has been minimized.

Copy link
@abrodkin

abrodkin May 8, 2019

Author Member
<feature name="org.gnu.gdb.arc.aux-minimal">
<reg name="pc" bitsize="32" regnum="64" save-restore="yes" type="code_ptr" group="general"/>
<reg name="lp_start" bitsize="32" regnum="65" save-restore="yes" type="code_ptr" group="general"/>
<reg name="lp_end" bitsize="32" regnum="66" save-restore="yes" type="code_ptr" group="general"/>
<flags id="status32_t" size="4">
<field name="H" start="0" end="0" type="bool" />
<field name="E0" start="1" end="1" type="bool" />
<field name="E1" start="2" end="2" type="bool" />
<field name="E2" start="3" end="3" type="bool" />
<field name="E3" start="4" end="4" type="bool" />
<field name="AE" start="5" end="5" type="bool" />
<field name="DE" start="6" end="6" type="bool" />
<field name="U" start="7" end="7" type="bool" />
<field name="V" start="8" end="8" type="bool" />
<field name="C" start="9" end="9" type="bool" />
<field name="N" start="10" end="10" type="bool" />
<field name="Z" start="11" end="11" type="bool" />
<field name="L" start="12" end="12" type="bool" />
<field name="DZ" start="13" end="13" type="bool" />
<field name="SC" start="14" end="14" type="bool" />
<field name="ES" start="15" end="15" type="bool" />
<field name="RB0" start="16" end="16" type="bool" />
<field name="RB1" start="17" end="17" type="bool" />
<field name="RB2" start="18" end="18" type="bool" />
<field name="AD" start="19" end="19" type="bool" />
<field name="US" start="20" end="20" type="bool" />
<field name="IE" start="31" end="31" type="bool" />
</flags>
<reg name="status32" bitsize="32" regnum="67" save-restore="yes" type="status32_t" group="general"/>
</feature>
<feature name="org.gnu.gdb.arc.aux-other">
...
<flags id="status32_t" size="4">
<field name="H" start="0" end="0" type="bool" />
<field name="E0" start="1" end="1" type="bool" />
<field name="E1" start="2" end="2" type="bool" />
<field name="E2" start="3" end="3" type="bool" />
<field name="E3" start="4" end="4" type="bool" />
<field name="AE" start="5" end="5" type="bool" />
<field name="DE" start="6" end="6" type="bool" />
<field name="U" start="7" end="7" type="bool" />
<field name="V" start="8" end="8" type="bool" />
<field name="C" start="9" end="9" type="bool" />
<field name="N" start="10" end="10" type="bool" />
<field name="Z" start="11" end="11" type="bool" />
<field name="L" start="12" end="12" type="bool" />
<field name="DZ" start="13" end="13" type="bool" />
<field name="SC" start="14" end="14" type="bool" />
<field name="ES" start="15" end="15" type="bool" />
<field name="RB0" start="16" end="16" type="bool" />
<field name="RB1" start="17" end="17" type="bool" />
<field name="RB2" start="18" end="18" type="bool" />
<field name="AD" start="19" end="19" type="bool" />
<field name="US" start="20" end="20" type="bool" />
<field name="IE" start="31" end="31" type="bool" />
</flags>
<reg name="erstatus" bitsize="32" regnum="98" save-restore="yes" type="status32_t" group=""/>

This comment has been minimized.

Copy link
@abrodkin

abrodkin May 8, 2019

Author Member

I don't - in the past I've always looked at it using set debug remote.

Gotcha, it looks like ARC's GDB implementation relies on multiple features - there are several other targets that do this as well, though I'm not sure if those have duplicate types or not. The best advice I can give is to submit this upstream and tag borneo.antonio@gmail.com and matthias@welwarsky.de as reviewers to see what they think. I'm happy to be a reviewer as well if you'd like another set of eyes.

Done, see http://openocd.zylin.com/#/c/5160/

}
}
}
Expand Down

0 comments on commit 2a5f512

Please sign in to comment.