mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
gdb/thread.py:Remove dependence on g_current_regs
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
@@ -176,6 +176,20 @@ static int tcbinfo_close(FAR struct file *filep)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: tcbinfo_current_regs
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* A special version of up_current_regs() that is non-optimized.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
nooptimiziation_function
|
||||||
|
FAR static void *tcbinfo_current_regs(void)
|
||||||
|
{
|
||||||
|
return up_current_regs();
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: tcbinfo_read
|
* Name: tcbinfo_read
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -198,8 +212,9 @@ static ssize_t tcbinfo_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
if (filep->f_pos == 0)
|
if (filep->f_pos == 0)
|
||||||
{
|
{
|
||||||
linesize = procfs_snprintf(attr->line, TCBINFO_LINELEN,
|
linesize = procfs_snprintf(attr->line, TCBINFO_LINELEN,
|
||||||
"pointer %p size %zu\n", &g_tcbinfo,
|
"pointer %p size %zu current regs %p\n",
|
||||||
sizeof(struct tcbinfo_s));
|
&g_tcbinfo, sizeof(struct tcbinfo_s),
|
||||||
|
tcbinfo_current_regs());
|
||||||
|
|
||||||
/* Save the linesize in case we are re-entered with f_pos > 0 */
|
/* Save the linesize in case we are re-entered with f_pos > 0 */
|
||||||
|
|
||||||
|
|||||||
@@ -264,7 +264,11 @@
|
|||||||
|
|
||||||
/* The nooptimiziation_function attribute no optimize */
|
/* The nooptimiziation_function attribute no optimize */
|
||||||
|
|
||||||
# define nooptimiziation_function __attribute__((optimize(0)))
|
# if defined(__clang__)
|
||||||
|
# define nooptimiziation_function __attribute__((optnone))
|
||||||
|
# else
|
||||||
|
# define nooptimiziation_function __attribute__((optimize("O0")))
|
||||||
|
# endif
|
||||||
|
|
||||||
/* The nosanitize_address attribute informs GCC don't sanitize it */
|
/* The nosanitize_address attribute informs GCC don't sanitize it */
|
||||||
|
|
||||||
|
|||||||
+3
-11
@@ -82,7 +82,8 @@ class Nxsetregs(gdb.Command):
|
|||||||
super(Nxsetregs, self).__init__("nxsetregs", gdb.COMMAND_USER)
|
super(Nxsetregs, self).__init__("nxsetregs", gdb.COMMAND_USER)
|
||||||
|
|
||||||
def invoke(self, args, from_tty):
|
def invoke(self, args, from_tty):
|
||||||
current_regs = gdb.parse_and_eval("g_current_regs")
|
gdb.execute("set $_current_regs=tcbinfo_current_regs()")
|
||||||
|
current_regs = gdb.parse_and_eval("$_current_regs")
|
||||||
tcbinfo = gdb.parse_and_eval("g_tcbinfo")
|
tcbinfo = gdb.parse_and_eval("g_tcbinfo")
|
||||||
arg = args.split(" ")
|
arg = args.split(" ")
|
||||||
|
|
||||||
@@ -91,16 +92,7 @@ class Nxsetregs(gdb.Command):
|
|||||||
gdb.lookup_type("char").pointer()
|
gdb.lookup_type("char").pointer()
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if utils.is_target_smp():
|
regs = current_regs.cast(gdb.lookup_type("char").pointer())
|
||||||
gdb.execute("set $_index=up_cpu_index()")
|
|
||||||
index = gdb.parse_and_eval("$_index")
|
|
||||||
else:
|
|
||||||
index = 0
|
|
||||||
|
|
||||||
if current_regs[index] == 0:
|
|
||||||
return
|
|
||||||
|
|
||||||
regs = current_regs[index].cast(gdb.lookup_type("char").pointer())
|
|
||||||
|
|
||||||
if regs == 0:
|
if regs == 0:
|
||||||
gdb.write("regs is NULL\n")
|
gdb.write("regs is NULL\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user