add toolchains for macOS on Apple Intel
xtensa-esp32s2
xtensa-esp32s3
add toolchains for macOS on Apple Silicon
xtensa-esp32s2
xtensa-esp32s3
add install for ubuntu.sh
xtensa-esp32s2
xtensa-esp32s3
add install for linux.sh
xtensa-esp32s2
xtensa-esp32s3
For unknown reason, for some cases, GDB refuses to read register using descriptor. Let's stick to the register name.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
`thread` is a GDB prefix command. Use `define` can only change it to a
user prefix command. In this case, `thread 3` is unable to pass
the argument 3 to python.
Use python code to register command to overwrite this behavior. It may
not work with future GDB, but all is good for now.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
gdb.error could report if memory is corrupted. Save and report the exception and continue to next command.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Should use gdbinit.py instead of package __init__.py. Report the correct usage if user try to source the package directly.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
1. The prev free flag should use field size instead of preceding to compare.
2. If not prev-free, then prevnode should be None.
3. Cast type to mm_freenode_s in order to access flink, blink when node is free.
4. Heap itself is also included in first region.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Added __format__ method to support format spec like {:>10} that gdb.Value doesn't support. For such case, gdb.Value is converted to python value firstly and then format natively.
Override all methods/attributes could return gdb.Value to return utils.Value instead.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Use a class Bactrace to support convert address to backtrace, format to string, accessing element and iterate though them.
Adjust usage in fs and addr2line to make full use of it.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Add simple time command to test time cost of a command.
Usage:
(gdb) time memleak
...
(gdb) Time elapsed: 1.23456s
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
1. Support any type of value as pointer address in container_of
2. Support string as type in offset_of
3. Make sure type is a pointer in container_of, and not a pointer in
offset_of
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
We're using `ptr.cast(get_long_type())` a week ago to get the pointer's value, it's alright, but `ptr.address` is not, the `ptr.address` will return **the address of the pointer**.
These values are the address of first element in the queue:
- `int(g_sigfreeaction["head"])`
- `g_sigfreeaction["head"].cast(get_long_type())`
- `g_sigfreeaction["head"].dereference().address`
But:
`int(g_sigfreeaction["head"].address)` is the address of the "head" member, which equals to the address of `g_sigfreeaction`
It's happening in NxSQueue:
g_sigfreeaction = gdb.parse_and_eval("g_sigfreeaction")
print(["%x" % (node) for node in NxSQueue(g_sigfreeaction)])
print(["%x" % (node) for node in NxSQueue(g_sigfreeaction, "sigactq_t", "flink")])
Without this patch:
['f3c0aa10', 'f3c0aa2c', 'f3c0aa48']
['55db90a0', 'f3c0aa10', 'f3c0aa2c']
With this patch:
['f3c0aa10', 'f3c0aa2c', 'f3c0aa48']
['f3c0aa10', 'f3c0aa2c', 'f3c0aa48']
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
After we introduced NxDQueue and NxSQueue, we're using them like `NxDQueue(g_active_connections, "struct socket_conn_s", "node")` and leads to `utils.container_of(ptr, str, str)`, so maybe we need to allow str input for `utils.container_of`
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
Use json module to save macro info to json file and load directly. It can save 2seconds for x4b projects to load plugin
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
We may get normal IPv4 address print like 10.10.0.1:5001 and a longer
IPv6 like fc000000000000000000000000000001:5001
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>