Display various information of current execution context Usage: MYNAME [reg,code,stack,all] [code/stack length]
(self, *arg)
| 4348 | return |
| 4349 | |
| 4350 | def context(self, *arg): |
| 4351 | """ |
| 4352 | Display various information of current execution context |
| 4353 | Usage: |
| 4354 | MYNAME [reg,code,stack,all] [code/stack length] |
| 4355 | """ |
| 4356 | |
| 4357 | (opt, count) = normalize_argv(arg, 2) |
| 4358 | |
| 4359 | if to_int(count) is None: |
| 4360 | count = 8 |
| 4361 | if opt is None: |
| 4362 | opt = config.Option.get("context") |
| 4363 | if opt == "all": |
| 4364 | opt = "register,code,stack" |
| 4365 | |
| 4366 | opt = opt.replace(" ", "").split(",") |
| 4367 | |
| 4368 | if not opt: |
| 4369 | return |
| 4370 | |
| 4371 | if not self._is_running(): |
| 4372 | return |
| 4373 | |
| 4374 | clearscr = config.Option.get("clearscr") |
| 4375 | if clearscr == "on": |
| 4376 | clearscreen() |
| 4377 | |
| 4378 | status = peda.get_status() |
| 4379 | # display registers |
| 4380 | if "reg" in opt or "register" in opt: |
| 4381 | self.context_register() |
| 4382 | |
| 4383 | # display assembly code |
| 4384 | if "code" in opt: |
| 4385 | self.context_code(count) |
| 4386 | |
| 4387 | # display stack content, forced in case SIGSEGV |
| 4388 | if "stack" in opt or "SIGSEGV" in status: |
| 4389 | self.context_stack(count) |
| 4390 | msg("[%s]" % ("-"*78), "blue") |
| 4391 | msg("Legend: %s, %s, %s, value" % (red("code"), blue("data"), green("rodata"))) |
| 4392 | |
| 4393 | # display stopped reason |
| 4394 | if "SIG" in status: |
| 4395 | msg("Stopped reason: %s" % red(status)) |
| 4396 | |
| 4397 | return |
| 4398 | |
| 4399 | def breakrva(self, *arg): |
| 4400 | """ |
nothing calls this directly
no test coverage detected