[sane-devel] 【Sane Develop】Can you help me

Stef stef.dev at free.fr
Thu Aug 22 19:36:57 UTC 2013


On 22/08/2013 15:20, m. allan noah wrote:
> We have a debugging library which is part of sane-backends. It allows 
> you to set an environment variable, and which causes the backend to 
> print messages to STDERR. If your backend is part of sane-backends, 
> you can use this library. If you backend is outside of sane-backends, 
> you can certainly setup something similar in your backend. You should 
> not have to recompile the frontend.
>
> allan
>
>
> On Thu, Aug 22, 2013 at 6:46 AM, <YiHao at rst.ricoh.com 
> <mailto:YiHao at rst.ricoh.com>> wrote:
>
>
>     Dear Sir or Madam:
>
>     I want to know,
>     How can I debug the sane-backend by frontend(e.g. scanimage),
>
>     How to enter the backend's breakpoint,
>     Do I need to compile the frontend if I want to know  whether the
>     backend
>     receives the Frontend command.
>
>
>
>
>
>     Can you give me some advise, Thank you.
>     Best Regard
>
>     Yours Sincerely, Yihao
>
>
>     --
>     sane-devel mailing list: sane-devel at lists.alioth.debian.org
>     <mailto:sane-devel at lists.alioth.debian.org>
>     http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
>     Unsubscribe: Send mail with subject "unsubscribe your_password"
>                  to sane-devel-request at lists.alioth.debian.org
>     <mailto:sane-devel-request at lists.alioth.debian.org>
>
>
>
>
> -- 
> "The truth is an offense, but not a sin"
>
>
     Hello,

     you may also consider compiling with debug option, by default the 
-O2 option ins SANE build system will optimize out many information. 
When debugging I add the -ggdb option to configure to be able to step 
into code with gdb:
CFLAGS="-ggdb" ./configure \
--prefix=/usr \
--sysconfdir=/etc \
--libdir=/usr/lib64 \
--enable-parport-directio \
--enable-pnm-backend \
--enable-libusb_1_0 \
--enable-pthread \
--enable-locking \
--with-group=scanner \
--without-snmp

Then you can debug your backend even used through a frontend like xsane 
with:

gdb /usr/bin/xsane

Then you can set breakpoint, gdb will warned if function aren't resolved 
yet, but it will work here a sample session for the genesys backend:

(gdb) b genesys_sane_start
Function "genesys_sane_start" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 3 (genesys_sane_start) pending.
(gdb) r
Starting program: /usr/bin/xsane
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
Traceback (most recent call last):
   File 
"/usr/share/gdb/auto-load/usr/lib64/libgobject-2.0.so.0.3600.4-gdb.py", l
ine 9, in <module>
     from gobject import register
   File "/usr/share/glib-2.0/gdb/gobject.py", line 3, in <module>
     import gdb.backtrace
ImportError: No module named backtrace
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffeb5cb700 (LWP 2593)]

Breakpoint 2, sane_start (h=0x7a43a0) at genesys-s.c:48

Regards,
     Stef



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20130822/1c3f61ff/attachment.html>


More information about the sane-devel mailing list