LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-29-2008, 09:04 AM   #1
webquinty
Member
 
Registered: Apr 2008
Location: Espaņa
Distribution: Suse
Posts: 227

Rep: Reputation: 32
Doubt with variables dump????


Hello,
Can I use objdump to extract information from a section???
In this moment, objdump give me a lot of information of several sections of program??

or, perhaps there is other program to do it??

best regrads.
 
Old 10-29-2008, 09:58 AM   #2
alex1983-0112
Member
 
Registered: Apr 2008
Location: Russia
Distribution: Fedora Core
Posts: 30

Rep: Reputation: 16
Try to use:
Code:
objcopy --only-section <section_name> input_file
.

Hope this help!

Last edited by alex1983-0112; 10-29-2008 at 10:01 AM.
 
Old 10-29-2008, 03:36 PM   #3
webquinty
Member
 
Registered: Apr 2008
Location: Espaņa
Distribution: Suse
Posts: 227

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by alex1983-0112 View Post
Try to use:
Code:
objcopy --only-section <section_name> input_file
.

Hope this help!
Hello,

Well, I have searched more information about this command, but it is impossible to use it, all the time returns me a warning a no more information.

BFD: prueba: warning: Empty loadable segment detected, is this intentional ?

Could you explain me more how to use this command??

Best regards
 
Old 10-31-2008, 09:18 AM   #4
alex1983-0112
Member
 
Registered: Apr 2008
Location: Russia
Distribution: Fedora Core
Posts: 30

Rep: Reputation: 16
Usage: objcopy [option(s)] in-file [out-file]
Copies a binary file, possibly transforming it in the process
The options are:
-I --input-target <bfdname> Assume input file is in format <bfdname>
-O --output-target <bfdname> Create an output file in format <bfdname>
-B --binary-architecture <arch> Set arch of output file, when input is binary
-F --target <bfdname> Set both input and output format to <bfdname>
--debugging Convert debugging information, if possible
-p --preserve-dates Copy modified/access timestamps to the output
-j --only-section <name> Only copy section <name> into the output
--add-gnu-debuglink=<file> Add section .gnu_debuglink linking to <file>
-R --remove-section <name> Remove section <name> from the output
-S --strip-all Remove all symbol and relocation information
-g --strip-debug Remove all debugging symbols & sections
--strip-unneeded Remove all symbols not needed by relocations
-N --strip-symbol <name> Do not copy symbol <name>
--strip-unneeded-symbol <name>
Do not copy symbol <name> unless needed by
relocations
--only-keep-debug Strip everything but the debug information
-K --keep-symbol <name> Do not strip symbol <name>
-L --localize-symbol <name> Force symbol <name> to be marked as a local
--globalize-symbol <name> Force symbol <name> to be marked as a global
-G --keep-global-symbol <name> Localize all symbols except <name>
-W --weaken-symbol <name> Force symbol <name> to be marked as a weak
--weaken Force all global symbols to be marked as weak
-w --wildcard Permit wildcard in symbol comparison
-x --discard-all Remove all non-global symbols
-X --discard-locals Remove any compiler-generated symbols
-i --interleave <number> Only copy one out of every <number> bytes
-b --byte <num> Select byte <num> in every interleaved block
--gap-fill <val> Fill gaps between sections with <val>
--pad-to <addr> Pad the last section up to address <addr>
--set-start <addr> Set the start address to <addr>
{--change-start|--adjust-start} <incr>
Add <incr> to the start address
{--change-addresses|--adjust-vma} <incr>
Add <incr> to LMA, VMA and start addresses
{--change-section-address|--adjust-section-vma} <name>{=|+|-}<val>
Change LMA and VMA of section <name> by <val>
--change-section-lma <name>{=|+|-}<val>
Change the LMA of section <name> by <val>
--change-section-vma <name>{=|+|-}<val>
Change the VMA of section <name> by <val>
{--[no-]change-warnings|--[no-]adjust-warnings}
Warn if a named section does not exist
--set-section-flags <name>=<flags>
Set section <name>'s properties to <flags>
--add-section <name>=<file> Add section <name> found in <file> to output
--rename-section <old>=<new>[,<flags>] Rename section <old> to <new>
--change-leading-char Force output format's leading character style
--remove-leading-char Remove leading character from global symbols
--redefine-sym <old>=<new> Redefine symbol name <old> to <new>
--redefine-syms <file> --redefine-sym for all symbol pairs
listed in <file>
--srec-len <number> Restrict the length of generated Srecords
--srec-forceS3 Restrict the type of generated Srecords to S3
--strip-symbols <file> -N for all symbols listed in <file>
--strip-unneeded-symbols <file>
--strip-unneeded-symbol for all symbols listed
in <file>
--keep-symbols <file> -K for all symbols listed in <file>
--localize-symbols <file> -L for all symbols listed in <file>
--globalize-symbols <file> --globalize-symbol for all in <file>
--keep-global-symbols <file> -G for all symbols listed in <file>
--weaken-symbols <file> -W for all symbols listed in <file>
--alt-machine-code <index> Use alternate machine code for output
--writable-text Mark the output text as writable
--readonly-text Make the output text write protected
--pure Mark the output file as demand paged
--impure Mark the output file as impure
--prefix-symbols <prefix> Add <prefix> to start of every symbol name
--prefix-sections <prefix> Add <prefix> to start of every section name
--prefix-alloc-sections <prefix>
Add <prefix> to start of every allocatable
section name
-v --verbose List all object files modified
-V --version Display this program's version number
-h --help Display this output
--info List object formats & architectures supported
objcopy: supported targets: pe-i386 pei-i386 elf32-i386 elf32-little elf32-big srec symbolsrec tekhex binary ihex
--------------------------------------------------


So, I can't to say you more about this command, because I use it for building binary file. But I assume that you should use it with '-I' option together.
Can you say me what do you want to do more in details? And which target are you use?
 
Old 10-31-2008, 10:00 AM   #5
webquinty
Member
 
Registered: Apr 2008
Location: Espaņa
Distribution: Suse
Posts: 227

Original Poster
Rep: Reputation: 32
Hello,

If I am sincere, I do not known what I want.
Well, I try to explain you my idea.

With GDB you can debug a program, but there is something that it is impossible to do it with GDB, make a watch of var without stop program.

I try to develop a protocol between programm and other PC with a Visual basic program.
Visual basic send to Linux commands and Linux respond. In this moment, with objdump, I have created a table with all vars of programm, and I took only vars that I want and send to Visual basic programm, name, address, length, type and value. Linux sendt all this information to Visual Basic programm, and after it I can request to Linux, for example, a value of some variable, every one second for example.

But the problem is objdump give a lot of information. I put my vars in two sections, .global_var and .local_var, and I am interesting to obtain information from theese sections.

Well, my english is not good, but I hope that you can understand the basic idea.

Best regards.
 
Old 10-31-2008, 10:17 AM   #6
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by webquinty View Post
With GDB you can debug a program, but there is something that it is impossible to do it with GDB
AFAIK, it isn't possible in most debuggers.

Quote:
Originally Posted by webquinty View Post
I try to develop a protocol between programm and other PC with a Visual basic program.
Visual basic send to Linux commands and Linux respond. In this moment, with objdump, I have created a table with all vars of programm, and I took only vars that I want and send to Visual basic programm, name, address, length, type and value.
If you want to watch several variables without stopping program, either print them all to the console, or create some kind of GUI window that'll display them while program is running. Printing to console is faster to implement.
 
Old 10-31-2008, 10:30 AM   #7
webquinty
Member
 
Registered: Apr 2008
Location: Espaņa
Distribution: Suse
Posts: 227

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by ErV View Post
AFAIK, it isn't possible in most debuggers.


If you want to watch several variables without stopping program, either print them all to the console, or create some kind of GUI window that'll display them while program is running. Printing to console is faster to implement.
Hello ErV,

Well, It is a good idea, but if the program and console is in the same PC.

But, What happen is linux program is in the computer A and debugger programm (Visual Basic) in the computer B???.

I suppose that you need serial port or socket, or other kind of communications.

Best regards.

Last edited by webquinty; 10-31-2008 at 10:32 AM.
 
Old 11-01-2008, 05:57 AM   #8
alex1983-0112
Member
 
Registered: Apr 2008
Location: Russia
Distribution: Fedora Core
Posts: 30

Rep: Reputation: 16
Quote:
Originally Posted by webquinty View Post
Well, my english is not good, but I hope that you can understand the basic idea.
You English is not so bad. :-)
 
Old 11-01-2008, 05:11 PM   #9
webquinty
Member
 
Registered: Apr 2008
Location: Espaņa
Distribution: Suse
Posts: 227

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by alex1983-0112 View Post
You English is not so bad. :-)
Thank you,

but I known that I need improve my english more.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
installing FreeBSD on Virtual Box error: "Cannot dump. No dump device defined" Valkyrie_of_valhalla *BSD 4 09-06-2007 04:02 AM
Doubt regarding Global variables declaration rajesh_b Programming 8 04-10-2007 09:07 PM
Threads synchronisation problem (mutex variables and contitional variables) zahadumy Programming 6 12-07-2005 12:30 PM
How to forcely dump the history of user commands to the admin dump file. mcp_achindra Linux - Security 1 03-19-2004 12:04 PM
Shel scripting: variables pointing to variables and case Dark_Helmet Programming 5 06-08-2003 11:07 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration