Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with memory watch (fail to show) #681

Closed
4 tasks done
arvyanh opened this issue Jul 27, 2021 · 6 comments
Closed
4 tasks done

Issue with memory watch (fail to show) #681

arvyanh opened this issue Jul 27, 2021 · 6 comments

Comments

@arvyanh
Copy link

arvyanh commented Jul 27, 2021

  • Did you use the latest version of GEF from dev branch?
  • Is your bug specific to GEF (not GDB)? - Try to reproduce it running gdb -nx
  • Did you read the documentation first?
  • Did you check issues (including
    the closed ones) - and the PR?

Step 1: Describe your environment

───────────────────────────── Runtime environment ──────────────────────────────

  • GDB: 10.2
  • Python: 3.8.10 - final
  • OS: Linux - 5.8.0-59-generic (x86_64)
    ──────────────────────────────────────────────

Step 2: Describe your problem

Steps to reproduce

  1. open executable
  2. watch a memory

Minimalist test case

     11      int* heap = malloc(sizeof(int)*1024);
     12
             // i=0x013      for(int i = 0; i < 1024; i++){
     14          heap[i] = i;
     15      }
     16

Observed Results

  • What happened? This could be a description, log output, etc.
    No memory dump are showed, and shows a hexdump error
...
───────────────────────────────────────────────────────────────────────── memory:0x5555555592a0 ────
usage: hexdump qword [-h] [--reverse] [--size SIZE] [address]
hexdump qword: error: unrecognized arguments: 16

─────────────────────────────── Exception raised ───────────────────────────────
RuntimeWarning:
───────────────────────────── Detailed stacktrace ──────────────────────────────
↳ File "/home/arvyanh/script/misc/gdb-dash/gef-git/gef.py", line 2603, in FakeExit()
    →     raise RuntimeWarning
↳ File "/usr/lib/python3.8/argparse.py", line 2520, in exit()
    →     _sys.exit(status)
↳ File "/usr/lib/python3.8/argparse.py", line 2533, in error()
    →     self.exit(2, _('%(prog)s: error: %(message)s\n') % args)
↳ File "/usr/lib/python3.8/argparse.py", line 1783, in parse_args()
    →     self.error(msg % ' '.join(argv))
↳ File "/home/arvyanh/script/misc/gdb-dash/gef-git/gef.py", line 2653, in wrapper()
    →     parsed_args = parser.parse_args(*(args[1:]))
↳ File "/home/arvyanh/script/misc/gdb-dash/gef-git/gef.py", line 2557, in wrapper()
    →     return f(*args, **kwargs)
↳ File "/home/arvyanh/script/misc/gdb-dash/gef-git/gef.py", line 239, in wrapper()
    →     return f(*args, **kwargs)
↳ File "/home/arvyanh/script/misc/gdb-dash/gef-git/gef.py", line 4201, in invoke()
    →     bufferize(self.do_invoke)(argv)

reverts to a early version seems to solve the issue: (I choose a random version earlier e.g. 6b82ee6 Jan 9, 2021)

The online test version also seems to work

Expected results

  • What did you expect to happen?
    memory show correctly.

Traces

all the info above are from debug mode

@arvyanh arvyanh added the triage label Jul 27, 2021
@theguy147
Copy link
Collaborator

can confirm that memory watch does not currently work (for me). A quick git bisect shows me that it doesn't work anymore since commit e38f7dd.

@theguy147
Copy link
Collaborator

theguy147 commented Jul 27, 2021

There is some mess with the syntax of the hexdump command since that commit.

memory watch calls hexdump [WORD_LENGTH] [LOCATION] [SIZE] for non-pointers. But this syntax doesn't work anymore since that commit. Now it should be (?) hexdump [WORD_LENGTH] [LOCATION] [--size SIZE].

Also the _syntax_ and _example_ for HexdumpCommand don't match for WORD_LENGTH (and are seemingly both currently wrong in regards to SIZE).

EDIT:

also with the new argparsing when entering a faulty hexdump command we get another completely different usage message

usage: hexdump byte [-h] [--reverse] [--size SIZE] [address]

which one should actually be used in the future?

@theguy147
Copy link
Collaborator

I guess a test for the memory watch command should be implemented once the expected syntax has been defined.

@hugsy
Copy link
Owner

hugsy commented Jul 27, 2021

I guess a test for the memory watch command should be implemented once the expected syntax has been defined.

100% - and to be honest I thought it was 😁

@theguy147
Copy link
Collaborator

@arvyanh Can you update GEF and see if your issue has been solved?

@arvyanh
Copy link
Author

arvyanh commented Jul 28, 2021

@arvyanh Can you update GEF and see if your issue has been solved?

Yes, I think its working now

@arvyanh arvyanh closed this as completed Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants