Code Monkey home page Code Monkey logo

Comments (16)

hugsy avatar hugsy commented on September 28, 2024

That's a pretty good idea. Will add that.

Thanks!

from gef.

hugsy avatar hugsy commented on September 28, 2024

It should be working as expected. Let me know if you find bugs.

img

from gef.

hugsy avatar hugsy commented on September 28, 2024

Confirmed works on x86, ARM, PowerPC for gdb > 7.9 (for gdb.find_pc_line())

from gef.

bnagy avatar bnagy commented on September 28, 2024

By >7.9 you mean it only works on 7.10? I re-enabled the exception printing and I get:

[!] in `context_source, exception raised: 'utf-8' codec can't decode byte 0xa9 in position 96: invalid start byte

ben@shitweasel:~/src/jxrlib$ gdb -version
GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9

from gef.

hugsy avatar hugsy commented on September 28, 2024

Which version of python are you using inside gdb ?

from gef.

bnagy avatar bnagy commented on September 28, 2024

I don't know how to check that. System python is 2.7 but I thought gdb always links against 3 now? I'll google tomorrow :P

from gef.

bsmt avatar bsmt commented on September 28, 2024

Open a python shell in gdb ("pi" command), then

import sys
sys.version

from gef.

hugsy avatar hugsy commented on September 28, 2024

@bnagy $ gdb -nx -ex 'python print (sys.version)' -ex quit

from gef.

bnagy avatar bnagy commented on September 28, 2024

'3.4.3 (default, Mar 26 2015, 22:07:14) \n[GCC 4.9.2]'

from gef.

hugsy avatar hugsy commented on September 28, 2024

I've setup an Ubuntu 14.04 with gdb 7.7 and python 3.4, could get your error triggered again.

Is it happening against all your bins ? Or just one ?

from gef.

bnagy avatar bnagy commented on September 28, 2024

It's just one, by the looks - AND the source file happens to have a non-utf-8 character in the source file, so that sounds like a good chance to be the problem. I tried a quick guess from @bsmt using return buf.decode("utf-8", "ignore") in read_string but that didn't work - maybe I missed something or that's the wrong place to try and ignore bad UTF-8.....

from gef.

hugsy avatar hugsy commented on September 28, 2024

Do you have a sample somewhere I can download so I try to reproduce locally ?

from gef.

bnagy avatar bnagy commented on September 28, 2024

Can't really, with this one... you should be able to put any non utf-8 char in the source though like from http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt

For now, I think I can run the codebase through iconv, which solves my immediate issue as per http://superuser.com/a/49147 (which is a possible workaround for anyone else with the issue, but hopefully it's easy to fix ;)

from gef.

hugsy avatar hugsy commented on September 28, 2024

Have you tried changing the charset (https://sourceware.org/gdb/onlinedocs/gdb/Character-Sets.html#Character-Sets) ? (set target-charset in gdb)

from gef.

bnagy avatar bnagy commented on September 28, 2024

I tried set target-charset WINDOWS-1252 with no luck. Fixing the source files via iconv still works. If you can't work out a way to clean / change the encoding in the plugin then it's probably OK to close this issue, or just open a new one for the encoding problem (since the enhancement is complete)

Thanks again for the tool :)

PS: Inplace fixing didn't seem to work for me. This script does.

#! /bin/sh

find . -name '*.c' -exec iconv --verbose -f windows-1252 -t utf-8 -o {}.fix {} \;
find . -name "*.c" -delete
find . -name "*.c.fix" -exec rename 's/\.fix$//' {} \;

from gef.

hugsy avatar hugsy commented on September 28, 2024

I haven't been able to find a clean so I guess I will do as you suggest and close the ticket keeping in mind your little script in case this issue happens again in the future.

Thanks for the feedbacks, always appreciated :)

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.