On Thu, Mar 31, 2022 at 6:29 AM Commit Bot <b...@cloudius-systems.com> wrote:
> From: Waldemar Kozaczuk <jwkozac...@gmail.com> > Committer: Waldemar Kozaczuk <jwkozac...@gmail.com> > Branch: master > > loader.py: add linear_mmap command > > Similarly to the patch that adds new pseudo file > /sys/osv/memory/linear_maps, > this one adds new loader.py command that can be used with gdb to display > same information: > > (gdb) osv linear_mmap > vaddr paddr size perm memattr name > 8000000 8000000 10000 rwxp dev gic_dist > 8010000 8010000 10000 rwxp dev gic_cpu > 9000000 9000000 1000 rwxp dev pl011 > 9010000 9010000 1000 rwxp dev pl031 > 10000000 10000000 2eff0000 rwxp dev pci_mem > 3eff0000 3eff0000 10000 rwxp dev pci_io > 40000000 40000000 6d3000 rwxp normal kernel > 4010000000 4010000000 10000000 rwxp dev pci_cfg > ffff80000a000000 a000000 200 rwxp normal virtio_mmio_cfg > ffff80000a000200 a000200 200 rwxp normal virtio_mmio_cfg > ffff80000a000400 a000400 200 rwxp normal virtio_mmio_cfg > ffff80000a000600 a000600 200 rwxp normal virtio_mmio_cfg > ffff80000a000800 a000800 200 rwxp normal virtio_mmio_cfg > ffff80000a000a00 a000a00 200 rwxp normal virtio_mmio_cfg > ffff80000a000c00 a000c00 200 rwxp normal virtio_mmio_cfg > ffff80000a000e00 a000e00 200 rwxp normal virtio_mmio_cfg > ffff8000406d3000 406d3000 7f92d000 rwxp normal main > ffff9000406d3000 406d3000 7f92d000 rwxp normal page > ffffa000406d3000 406d3000 7f92d000 rwxp normal mempool > > Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> > > --- > diff --git a/scripts/loader.py b/scripts/loader.py > --- a/scripts/loader.py > +++ b/scripts/loader.py > @@ -1643,11 +1643,40 @@ def invoke(self, args, from_tty): > return > gdb.write('%s\n'%target) > > +class osv_linear_mmap(gdb.Command): > + def __init__(self): > + gdb.Command.__init__(self, 'osv linear_mmap', > + gdb.COMMAND_USER, gdb.COMPLETE_NONE) > + def invoke(self, arg, for_tty): > + l = str(gdb.lookup_global_symbol('mmu::linear_vma_set').value()) > + linear_vmas = re.findall('\[([0-9]+)\] = (0x[0-9a-zA-Z]+)', l) > + > + gdb.write("%16s %16s %8s %4s %7s %s\n" % ("vaddr", "paddr", > "size", "perm", "memattr", "name")) > + > + char_ptr = gdb.lookup_type('char').pointer() > + for desc in linear_vmas: > + addr = desc[1] > + vma = gdb.parse_and_eval('(struct mmu::linear_vma *)' + addr) > + > + vaddr = vma['_virt_addr'] > + paddr = vma['_phys_addr'] > + size = vma['_size'] > + if vma['_mem_attr'] == 0: > + memattr = 'normal' > + else: > + memattr = 'dev' > + name = vma['_name'].cast(char_ptr).string() > + > + # dispatch time ns ticks callout function > Wrongly-copied comment? :-) > + gdb.write("%16x %16x %8x rwxp %7s %s\n" % > + (vaddr, paddr, size, memattr, name)) > + > osv() > osv_heap() > osv_memory() > osv_waiters() > osv_mmap() > +osv_linear_mmap() > osv_vma_find() > osv_zfs() > osv_syms() > > -- > You received this message because you are subscribed to the Google Groups > "OSv Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to osv-dev+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/osv-dev/0000000000002f6a2605db7b46c4%40google.com > . > -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/CANEVyjs5jZS%2BE%3DiXTEVWE-YqS3aFgAyb6EQ1E1BFYF1GaCzN_A%40mail.gmail.com.