Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
No Starch Press

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
Copyright Info
Terms of Use
Privacy Info
Masthead / Impressum
Your Account

Private Messages

News Archive
Submit News
User Articles
Web Links


The Web

Who's Online
There are currently, 51 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here




              tty prog [args...]

       gdbserver tty --attach PID


       GDBSERVER  is  a  program  that allows you to run GDB on a
       different machine than the one which is running  the  pro­
       gram being debugged.

       Usage (server (target) side):

       First,  you need to have a copy of the program you want to
       debug put onto the target  system.   The  program  can  be
       stripped  to  save  space  if needed, as GDBserver doesn't
       care about symbols.  All symbol handling is taken care  of
       by the GDB running on the host system.

       To  use  the  server, you log on to the target system, and
       run the `gdbserver' program.  You must tell it (a) how  to
       communicate  with  GDB,  (b) the name of your program, and
       (c) its arguments.  The general syntax is:

            target> gdbserver COMM PROGRAM [ARGS ...]

       For example, using a serial port, you might say:

            target> gdbserver /dev/com1 emacs foo.txt

       This tells gdbserver to debug emacs with  an  argument  of
       foo.txt,  and to communicate with GDB via /dev/com1.  Gdb­
       server now waits patiently for the host GDB to communicate
       with it.

       To use a TCP connection, you could say:

            target> gdbserver host:2345 emacs foo.txt

       This  says pretty much the same thing as the last example,
       except that we are going to communicate with the host  GDB
       via  TCP.   The  `host:2345'  argument  means  that we are
       expecting to see a TCP connection from `host' to local TCP
       port  2345.  (Currently, the `host' part is ignored.)  You
       can choose any number you want for the port number as long
       as it does not conflict with any existing TCP ports on the
       target system.  This same port number must be used in  the
       host GDBs `target remote' command, which will be described
       shortly.  Note that if you chose a port number  that  con­
       flicts with another service, gdbserver will print an error
       message and exit.

       and such.  Start up GDB as you normally  would,  with  the
       target  program  as  the first argument.  (You may need to
       use the --baud option if the serial  line  is  running  at
       anything  except  9600  baud.)   Ie: `gdb TARGET-PROG', or
       `gdb --baud BAUD TARGET-PROG'.  After that, the  only  new
       command  you  need to know about is `target remote'.  It's
       argument is either a device name (usually a serial device,
       like  `/dev/ttyb'),  or a HOST:PORT descriptor.  For exam­

            (gdb) target remote /dev/ttyb

       communicates with the server via  serial  line  /dev/ttyb,

            (gdb) target remote the-target:2345

       communicates  via  a  TCP  connection to port 2345 on host
       `the-target', where you previously  started  up  gdbserver
       with the same port number.  Note that for TCP connections,
       you must start up gdbserver prior  to  using  the  `target
       remote' command, otherwise you may get an error that looks
       something like `Connection refused'.


       You have to supply the name of the program  to  debug  and
       the  tty  to communicate on; the remote GDB will do every­
       thing else.  Any remaining arguments will be passed to the
       program verbatim.


       `gdb' entry in info; Using GDB: A Guide to the GNU Source-
       Level Debugger, Richard M. Stallman and Roland  H.  Pesch,
       July 1991.


       Copyright (c) 1993 Free Software Foundation, Inc.

       Permission  is  granted  to  make  and distribute verbatim
       copies of this manual provided the  copyright  notice  and
       this permission notice are preserved on all copies.

       Permission is granted to copy and distribute modified ver­
       sions of this manual under  the  conditions  for  verbatim
       copying,  provided  that the entire resulting derived work
       is distributed under the  terms  of  a  permission  notice
       identical to this one.

       Permission  is granted to copy and distribute translations
       of this manual into another language, under the above con­
       ditions for modified versions, except that this permission
       notice may be included in  translations  approved  by  the



Security Code
Security Code
Type Security Code

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!

Amazon Wish List

Did You Know?
You can get all the latest Site and Linux news by checking out our news page.


Tell a Friend About Us

Bookmark and Share

Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.12 Seconds