• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂a83bb5eac4bee23360bed7fbd5a4e438a4eaec47 (tree)
時間2017-08-21 19:18:12
作者Yao Qi <yao.qi@lina...>
CommiterYao Qi

Log Message

Adjust code generated by regformats/regdat.sh

regformats/regdat.sh generate some *-generated.c files when GDBserver
is built. Each .c file has some static variables, which are only used
within function init_registers_XXX, like this,

static struct reg regs_i386_linux[] = {

{ "eax", 0, 32 },
{ "ecx", 32, 32 },
...

};

static const char *expedite_regs_i386_linux[] = { "ebp", "esp", "eip", 0 };
static const char *xmltarget_i386_linux = "i386-linux.xml";

void
init_registers_i386_linux (void)
{

...

}

This patch moves these static variables' definitions to function
init_registers_XXX, so the generated files look like this,

void
init_registers_i386_linux (void)
{

static struct target_desc tdesc_i386_linux_s;
struct target_desc *result = &tdesc_i386_linux_s;

static struct reg regs_i386_linux[] = {

...

};

static const char *expedite_regs_i386_linux[] = { "ebp", "esp", "eip", 0 };
static const char *xmltarget_i386_linux = "i386-linux.xml";

...

}

We want GDBserver create target descriptions dynamically in each
init_registers_XXXX functions, so this patch moves all the related code
into function init_registers_XXXX, so that the following patch can easily
change function init_registers_XXXX to create target description
dynamically, rather than using current pre-generated array.

gdb:

2017-06-06 Yao Qi <yao.qi@linaro.org>

* regformats/regdat.sh: Adjust code order.

Change Summary

差異

--- a/gdb/regformats/regdat.sh
+++ b/gdb/regformats/regdat.sh
@@ -123,6 +123,15 @@ while do_read
123123 do
124124 if test "${type}" = "name"; then
125125 name="${entry}"
126+
127+ echo "const struct target_desc *tdesc_${name};"
128+ echo ""
129+ echo "void"
130+ echo "init_registers_${name} (void)"
131+ echo "{"
132+ echo " static struct target_desc tdesc_${name}_s;"
133+ echo " struct target_desc *result = &tdesc_${name}_s;"
134+
126135 echo "static struct reg regs_${name}[] = {"
127136 continue
128137 elif test "${type}" = "xmltarget"; then
@@ -169,14 +178,6 @@ fi
169178 echo
170179
171180 cat <<EOF
172-const struct target_desc *tdesc_${name};
173-
174-void
175-init_registers_${name} (void)
176-{
177- static struct target_desc tdesc_${name}_s;
178- struct target_desc *result = &tdesc_${name}_s;
179-
180181 result->reg_defs = regs_${name};
181182 result->num_registers = sizeof (regs_${name}) / sizeof (regs_${name}[0]);
182183