question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hello!

I have the following problem:

pwndbg> p printf
$3 = {int (const char *, ...)} 0x7ffff7e33e10 <__printf>
pwndbg> xinfo 0x7ffff7e33e10
Extended information for virtual address 0x7ffff7e33e10:

  Containing mapping:
    0x7ffff7df4000     0x7ffff7f6c000 r-xp   178000 25000  /usr/lib/x86_64-linux-gnu/libc-2.31.so

  Offset information:
         Mapped Area 0x7ffff7e33e10 = 0x7ffff7df4000 + 0x3fe10
         File (Base) 0x7ffff7e33e10 = 0x7ffff7dcf000 + 0x64e10
'xinfo': Shows offsets of the specified address to useful other locations
Exception occurred: xinfo: argument of type 'int' is not iterable (<class 'TypeError'>)
For more info invoke `set exception-verbose on` and rerun the command
or debug it by yourself with `set exception-debugger on`

more details:

pwndbg> set exception-verbose on
Set whether to print a full stacktracefor exceptions raised in Pwndbg commands to True
pwndbg> xinfo 0x7ffff7e33e10
Extended information for virtual address 0x7ffff7e33e10:

  Containing mapping:
    0x7ffff7df4000     0x7ffff7f6c000 r-xp   178000 25000  /usr/lib/x86_64-linux-gnu/libc-2.31.so

  Offset information:
         Mapped Area 0x7ffff7e33e10 = 0x7ffff7df4000 + 0x3fe10
         File (Base) 0x7ffff7e33e10 = 0x7ffff7dcf000 + 0x64e10
'xinfo': Shows offsets of the specified address to useful other locations
Traceback (most recent call last):
  File "/opt/pwndbg/pwndbg/commands/__init__.py", line 136, in __call__
    return self.function(*args, **kwargs)
  File "/opt/pwndbg/pwndbg/commands/__init__.py", line 227, in _OnlyWhenRunning
    return function(*a, **kw)
  File "/opt/pwndbg/pwndbg/commands/xinfo.py", line 126, in xinfo
    xinfo_mmap_file(page, addr)
  File "/opt/pwndbg/pwndbg/commands/xinfo.py", line 72, in xinfo_mmap_file
    containing_loads = [seg for seg in pwndbg.elf.get_containing_segments(file_name, first.vaddr, addr)
  File "/opt/pwndbg/pwndbg/elf.py", line 153, in get_containing_segments
    if 'LOAD' not in seg['p_type'] and seg['p_filesz'] == 0:
TypeError: argument of type 'int' is not iterable

versions are:

pwndbg> version
Gdb:      9.1
Python:   3.8.2 (default, Apr 27 2020, 15:53:34)  [GCC 9.3.0]
Pwndbg:   1.1.0 build: 609284c
Capstone: 4.0.1024
Unicorn:  1.0.2

my system:

$ uname -a
Linux ubuntu2004.localdomain 5.4.0-29-generic #33-Ubuntu SMP Wed Apr 29 14:32:27 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/issue
Ubuntu 20.04 LTS \n \l

more information from bugreport --run-browser:

Gdb session history:
start
p printf
xinfo 0x7ffff7e33e10
set exception-verbose on
xinfo 0x7ffff7e33e10

Platform: Linux-5.4.0-29-generic-x86_64-with-glibc2.29
Gdb:      9.1
Python:   3.8.2 (default, Apr 27 2020, 15:53:34)  [GCC 9.3.0]
Pwndbg:   1.1.0 build: 609284c
Capstone: 4.0.1024
Unicorn:  1.0.2
This GDB was configured as follows:
   configure --host=x86_64-linux-gnu --target=x86_64-linux-gnu
             --with-auto-load-dir=$debugdir:$datadir/auto-load
             --with-auto-load-safe-path=$debugdir:$datadir/auto-load
             --with-expat
             --with-gdb-datadir=/usr/share/gdb (relocatable)
             --with-jit-reader-dir=/usr/lib/gdb (relocatable)
             --without-libunwind-ia64
             --with-lzma
             --with-babeltrace
             --without-intel-pt
             --with-mpfr
             --without-xxhash
             --with-python=/usr (relocatable)
             --without-guile
             --disable-source-highlight
             --with-separate-debug-dir=/usr/lib/debug (relocatable)
             --with-system-gdbinit=/etc/gdb/gdbinit

I also attached the file I used: relocoverwrite.zip

Best Martin

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
martinclausscommented, Jun 7, 2020

Awesome! I just checked the dev branch and everything is working as expected! 😃 Thanks a lot for investigating and fixing the bug so quickly =)

1reaction
martinclausscommented, Jun 7, 2020

It also seems that it effects Ubuntu 19.10 (gdb 8.3) as well…:

Ubuntu 18.04 WORKS

pwndbg: loaded 177 commands. Type pwndbg [filter] for a list.
pwndbg: created $rebase, $ida gdb functions (can be used with print/break)

Temporary breakpoint 1 at 0x1090

Temporary breakpoint 1, 0x0000555555555090 in main ()
Extended information for virtual address 0x7ffff7a48e80:

  Containing mapping:
    0x7ffff79e4000     0x7ffff7bcb000 r-xp   1e7000 0      /lib/x86_64-linux-gnu/libc-2.27.so

  Offset information:
         Mapped Area 0x7ffff7a48e80 = 0x7ffff79e4000 + 0x64e80
         File (Base) 0x7ffff7a48e80 = 0x7ffff79e4000 + 0x64e80
      File (Segment) 0x7ffff7a48e80 = 0x7ffff79e4000 + 0x64e80
         File (Disk) 0x7ffff7a48e80 = /lib/x86_64-linux-gnu/libc-2.27.so + 0x64e80

 Containing ELF sections:
               .text 0x7ffff7a48e80 = 0x7ffff7a052d0 + 0x43bb0
Gdb:      8.1.0.20180409-git
Python:   3.6.9 (default, Apr 18 2020, 01:56:04)  [GCC 8.4.0]
Pwndbg:   1.1.0 build: 606eae0
Capstone: 4.0.1024
Unicorn:  1.0.1

Ubuntu 19.10 EXCEPTION

pwndbg: loaded 178 commands. Type pwndbg [filter] for a list.
pwndbg: created $rebase, $ida gdb functions (can be used with print/break)
Temporary breakpoint 1 at 0x1090

Temporary breakpoint 1, 0x0000555555555090 in main ()
Extended information for virtual address 0x7ffff7e38d70:

  Containing mapping:
    0x7ffff7df9000     0x7ffff7f71000 r-xp   178000 25000  /usr/lib/x86_64-linux-gnu/libc-2.30.so

  Offset information:
         Mapped Area 0x7ffff7e38d70 = 0x7ffff7df9000 + 0x3fd70
         File (Base) 0x7ffff7e38d70 = 0x7ffff7dd4000 + 0x64d70
'xinfo': Shows offsets of the specified address to useful other locations
Traceback (most recent call last):
  File "/opt/pwndbg/pwndbg/commands/__init__.py", line 136, in __call__
    return self.function(*args, **kwargs)
  File "/opt/pwndbg/pwndbg/commands/__init__.py", line 227, in _OnlyWhenRunning
    return function(*a, **kw)
  File "/opt/pwndbg/pwndbg/commands/xinfo.py", line 126, in xinfo
    xinfo_mmap_file(page, addr)
  File "/opt/pwndbg/pwndbg/commands/xinfo.py", line 72, in xinfo_mmap_file
    containing_loads = [seg for seg in pwndbg.elf.get_containing_segments(file_name, first.vaddr, addr)
  File "/opt/pwndbg/pwndbg/elf.py", line 153, in get_containing_segments
    if 'LOAD' not in seg['p_type'] and seg['p_filesz'] == 0:
TypeError: argument of type 'int' is not iterable

If that is an issue, you can report it on https://github.com/pwndbg/pwndbg/issues
(Please don't forget to search if it hasn't been reported before)
To generate the report and open a browser, you may run `bugreport --run-browser`
PS: Pull requests are welcome
Gdb:      8.3
Python:   3.7.5 (default, Apr 19 2020, 20:18:17)  [GCC 9.2.1 20191008]
Pwndbg:   1.1.0 build: 606eae0
Capstone: 4.0.1024
Unicorn:  1.0.1

Ubuntu 20.04 EXCEPTION

pwndbg: loaded 178 commands. Type pwndbg [filter] for a list.
pwndbg: created $rebase, $ida gdb functions (can be used with print/break)
Temporary breakpoint 1 at 0x1090

Temporary breakpoint 1, 0x0000555555555090 in main ()
Extended information for virtual address 0x7ffff7e36e10:

  Containing mapping:
    0x7ffff7df7000     0x7ffff7f6f000 r-xp   178000 25000  /usr/lib/x86_64-linux-gnu/libc-2.31.so

  Offset information:
         Mapped Area 0x7ffff7e36e10 = 0x7ffff7df7000 + 0x3fe10
         File (Base) 0x7ffff7e36e10 = 0x7ffff7dd2000 + 0x64e10
'xinfo': Shows offsets of the specified address to useful other locations
Traceback (most recent call last):
  File "/opt/pwndbg/pwndbg/commands/__init__.py", line 136, in __call__
    return self.function(*args, **kwargs)
  File "/opt/pwndbg/pwndbg/commands/__init__.py", line 227, in _OnlyWhenRunning
    return function(*a, **kw)
  File "/opt/pwndbg/pwndbg/commands/xinfo.py", line 126, in xinfo
    xinfo_mmap_file(page, addr)
  File "/opt/pwndbg/pwndbg/commands/xinfo.py", line 72, in xinfo_mmap_file
    containing_loads = [seg for seg in pwndbg.elf.get_containing_segments(file_name, first.vaddr, addr)
  File "/opt/pwndbg/pwndbg/elf.py", line 153, in get_containing_segments
    if 'LOAD' not in seg['p_type'] and seg['p_filesz'] == 0:
TypeError: argument of type 'int' is not iterable

If that is an issue, you can report it on https://github.com/pwndbg/pwndbg/issues
(Please don't forget to search if it hasn't been reported before)
To generate the report and open a browser, you may run `bugreport --run-browser`
PS: Pull requests are welcome
Gdb:      9.1
Python:   3.8.2 (default, Apr 27 2020, 15:53:34)  [GCC 9.3.0]
Pwndbg:   1.1.0 build: 606eae0
Capstone: 4.0.1024
Unicorn:  1.0.1

I wrote a little shell script and Dockerfile that makes the testing a bit easier:

run_containers.sh:

#!/usr/bin/env bash

for image in 'ubuntu:18.04' 'ubuntu:19.10' 'ubuntu:20.04' 
do
	temp_docker_file=$(tempfile)
	sed -e "s/@image/$image/" Dockerfile > $temp_docker_file
	sudo docker build -t "pwndbg_test_${image}" - < $temp_docker_file 
	sudo docker run --rm -v$(pwd)/relocoverwrite:/test/binary:Z --cap-add=SYS_PTRACE "pwndbg_test_${image}"
	rm -f $temp_docker_file
	echo "check the output and press Enter to continue"
	read foo
done

Dockerfile:

FROM @image

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get upgrade -y && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y git

RUN cd /opt && \
    git clone https://github.com/pwndbg/pwndbg && \
    cd pwndbg && \
    DEBIAN_FRONTEND=noninteractive ./setup.sh

CMD printf_address=$(gdb -ex "start" -ex "p printf" -batch /test/binary | grep printf | grep -Po "0x[a-f0-9]+"); gdb -ex "set exception-verbose on" -ex "start" -ex "xinfo ${printf_address}" -ex "version" -batch /test/binary

Here is a zipped version of all the files: pwndbg_xinfo_test.zip

Read more comments on GitHub >

github_iconTop Results From Across the Web

xInfo.num Method (Dynamics.AX.Application) | Microsoft Learn
An integer that represents the number of exceptions of the type specified by the exceptionType parameter, or the total number of lines in...
Read more >
Exception Handling in LLVM — LLVM 16.0.0git documentation
LLVM landing pads are conceptually alternative function entry points where an exception structure reference and a type info index are passed in as...
Read more >
ex-info - clojure.core | ClojureDocs - ClojureDocs
Create an instance of ExceptionInfo, a RuntimeException subclass that carries a map of additional data. © Rich Hickey. All rights reserved. Eclipse Public ......
Read more >
Error in invoking target 'libasmclntsh19.ohso libasmperl19 ...
INFO : Exception thrown from action: make. Exception Name: MakefileException. Exception String: Error in invoking target 'libasmclntsh19.ohso ...
Read more >
How do I log an exception at warning- or info-level with ...
From the logging documentation: There are three keyword arguments in kwargs which are inspected: exc_info , stack_info , and extra .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found