Giter Site home page Giter Site logo

Comments (3)

hugsy avatar hugsy commented on May 8, 2024

Hi,

Thanks for this other bug. FYI, support for remote debug is still experimental in gef see ( #7 ) because as you may have noticed, there are a lot of constraints to overcome, which you do not have when debugging locally. I'm trying to do that in a clean way so it may take time, but suggestions, bugs and PR are sure welcome.

As you noticed, one of the big issues here is to get as many info from the process memory layout during runtime, for which I used /proc/self/maps because maintenance info files and info files do not provide enough information.

Even though I'm not looking for high perf, reading the memory from gdb is a perf killer, but you are right as I believe it is the right way to go. Happy to discuss if you have ideas about it.

Cheers

from gef.

uafio avatar uafio commented on May 8, 2024

I know it's quick and dirty implementation but I will go with this for now...

inside dereference_from()

2796             if addr is None:
2797                 msg.append( "%#x" % ( long(deref) ))
2798                 value_from_stack = long(DereferenceCommand.dereference(value))
2799                 msg.append( format_address(value_from_stack) )
2800                 examine_string = gdb.execute("x/s %#x" % value_from_stack, to_string=True).strip().replace("\n", "").replace("\r", "")
2801                 stack_string = re.findall('"(.*)"', examine_string)
2802                 if stack_string:
2803                     if '\\' not in stack_string[0]:
2804                         msg.append(stack_string[0])
2805                 break
2806             msg.append( "%s" % format_address( long(deref) ))
gef> c
Continuing.
------------------------------------------------------------------------------------------[regs]
$zero       0x00000000 $at         0xfffffff8 $v0         0x76fff5e4 $v1         0x0000002c 
$a0         0x76fff5f4 $a1         0x00000000 $a2         0x00000000 $a3         0x76fff5f4 
$t0         0x00000000 $t1         0x00000000 $t2         0x00000000 $t3         0x00000200 
$t4         0x00000100 $t5         0xfffffffe $t6         0x00000001 $t7         0x004012f8 
$s0         0x5615c73e $s1         0xffffffff $s2         0x76fff6e4 $s3         0x00400c38 
$s4         0x00000001 $s5         0x00400e80 $s6         0x00000000 $s7         0x00000000 
$t8         0x00000024 $t9         0x766ee1d0 $k0         0x00000000 $k1         0x00000000 
$s8         0x76fff5c0 $sr         0x20000010 $bad        0x00000000 $cause      0x00000000 
$pc         0x004012f8 $sp         0x76fff5c0 $hi         0x00000249 $lo         0x0001cbed 
$fir        0x00739300 $fsr        0x00000000 $ra         0x004012f8 $gp         0x76806010 

------------------------------------------------------------------------------------------[stack]
0x76fff5c0|+0x00: 0x0044a868 → ubuntu     ← $sp
0x76fff5c4|+0x04: 0x00000032
0x76fff5c8|+0x08: 0x0044a868 → ubuntu
0x76fff5cc|+0x0c: 0xfefefeff
0x76fff5d0|+0x10: 0x004520e0
0x76fff5d4|+0x14: 0x00400c38
0x76fff5d8|+0x18: 0x00000001
0x76fff5dc|+0x1c: 0x00400e80
0x76fff5e0|+0x20: 0x00000000
0x76fff5e4|+0x24: 0x00000000
------------------------------------------------------------------------------------------[code:mips:3000]
0x4012ec     <main+1132>  nop
0x4012f0     <main+1136>  jalr t9
0x4012f4     <main+1140>  nop
0x4012f8     <main+1144>  lw gp,16(s8)       ← $pc
0x4012fc     <main+1148>  li v0,2
0x401300     <main+1152>  sh v0,36(s8)
0x401304     <main+1156>  lw v0,-32744(gp)
0x401308     <main+1160>  nop
0x40130c     <main+1164>  addiu v0,v0,-21780
0x401310     <main+1168>  lhu v0,4(v0)
0x401314     <main+1172>  nop
0x401318     <main+1176>  move a0,v0
------------------------------------------------------------------------------------------[trace]
#0  0x004012f8 in main ()

Breakpoint 2, 0x004012f8 in main ()
gef> x/10wx $sp
0x76fff5c0: 0x0044a868  0x00000032  0x0044a868  0xfefefeff
0x76fff5d0: 0x004520e0  0x00400c38  0x00000001  0x00400e80
0x76fff5e0: 0x00000000  0x00000000
gef> 

I would say at least implement something like line 2799 so when the stack is printed out, it will at least show the content of the 10 words on it in hex...

from gef.

hugsy avatar hugsy commented on May 8, 2024

This bug should be fixed in a cleaner way by commit aabc740.
The command gef-remote allows to grasp all remote information and access them from gef as if they were local.

from gef.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.