mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-12-11 06:04:12 +00:00
* descriptors.cc (Descriptors::close_all): New function.
* descriptors.h (class Descriptors): Declare close_all. (close_all_descriptors): New inline function. * plugin.cc: Include "descriptors.h". (Plugin_manager::cleanup): Call close_all_descriptors.
This commit is contained in:
parent
6fe6ded97b
commit
20e2a8aa33
@ -1,3 +1,11 @@
|
|||||||
|
2013-02-11 Ian Lance Taylor <iant@google.com>
|
||||||
|
|
||||||
|
* descriptors.cc (Descriptors::close_all): New function.
|
||||||
|
* descriptors.h (class Descriptors): Declare close_all.
|
||||||
|
(close_all_descriptors): New inline function.
|
||||||
|
* plugin.cc: Include "descriptors.h".
|
||||||
|
(Plugin_manager::cleanup): Call close_all_descriptors.
|
||||||
|
|
||||||
2013-02-06 Alan Modra <amodra@gmail.com>
|
2013-02-06 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* README: Update coding style link.
|
* README: Update coding style link.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// descriptors.cc -- manage file descriptors for gold
|
// descriptors.cc -- manage file descriptors for gold
|
||||||
|
|
||||||
// Copyright 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
// Copyright 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
|
||||||
// Written by Ian Lance Taylor <iant@google.com>.
|
// Written by Ian Lance Taylor <iant@google.com>.
|
||||||
|
|
||||||
// This file is part of gold.
|
// This file is part of gold.
|
||||||
@ -251,6 +251,28 @@ Descriptors::close_some_descriptor()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close all the descriptors open for reading.
|
||||||
|
|
||||||
|
void
|
||||||
|
Descriptors::close_all()
|
||||||
|
{
|
||||||
|
Hold_optional_lock hl(this->lock_);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < this->open_descriptors_.size(); i++)
|
||||||
|
{
|
||||||
|
Open_descriptor* pod = &this->open_descriptors_[i];
|
||||||
|
if (pod->name != NULL && !pod->inuse && !pod->is_write)
|
||||||
|
{
|
||||||
|
if (::close(i) < 0)
|
||||||
|
gold_warning(_("while closing %s: %s"), pod->name, strerror(errno));
|
||||||
|
pod->name = NULL;
|
||||||
|
pod->stack_next = -1;
|
||||||
|
pod->is_on_stack = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this->stack_top_ = -1;
|
||||||
|
}
|
||||||
|
|
||||||
// The single global variable which manages descriptors.
|
// The single global variable which manages descriptors.
|
||||||
|
|
||||||
Descriptors descriptors;
|
Descriptors descriptors;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// descriptors.h -- manage file descriptors for gold -*- C++ -*-
|
// descriptors.h -- manage file descriptors for gold -*- C++ -*-
|
||||||
|
|
||||||
// Copyright 2008, 2009 Free Software Foundation, Inc.
|
// Copyright 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
|
||||||
// Written by Ian Lance Taylor <iant@google.com>.
|
// Written by Ian Lance Taylor <iant@google.com>.
|
||||||
|
|
||||||
// This file is part of gold.
|
// This file is part of gold.
|
||||||
@ -56,6 +56,10 @@ class Descriptors
|
|||||||
void
|
void
|
||||||
release(int descriptor, bool permanent);
|
release(int descriptor, bool permanent);
|
||||||
|
|
||||||
|
// Close all the descriptors open for reading.
|
||||||
|
void
|
||||||
|
close_all();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Information kept for a descriptor.
|
// Information kept for a descriptor.
|
||||||
struct Open_descriptor
|
struct Open_descriptor
|
||||||
@ -104,6 +108,10 @@ inline void
|
|||||||
release_descriptor(int descriptor, bool permanent)
|
release_descriptor(int descriptor, bool permanent)
|
||||||
{ descriptors.release(descriptor, permanent); }
|
{ descriptors.release(descriptor, permanent); }
|
||||||
|
|
||||||
|
inline void
|
||||||
|
close_all_descriptors()
|
||||||
|
{ descriptors.close_all(); }
|
||||||
|
|
||||||
} // End namespace gold.
|
} // End namespace gold.
|
||||||
|
|
||||||
#endif // !defined(GOLD_DESCRIPTORS_H)
|
#endif // !defined(GOLD_DESCRIPTORS_H)
|
||||||
|
@ -71,6 +71,7 @@ dlerror(void)
|
|||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include "readsyms.h"
|
#include "readsyms.h"
|
||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
|
#include "descriptors.h"
|
||||||
#include "elfcpp.h"
|
#include "elfcpp.h"
|
||||||
|
|
||||||
namespace gold
|
namespace gold
|
||||||
@ -697,6 +698,14 @@ Plugin_manager::layout_deferred_objects()
|
|||||||
void
|
void
|
||||||
Plugin_manager::cleanup()
|
Plugin_manager::cleanup()
|
||||||
{
|
{
|
||||||
|
if (this->any_added_)
|
||||||
|
{
|
||||||
|
// If any input files were added, close all the input files.
|
||||||
|
// This is because the plugin may want to remove them, and on
|
||||||
|
// Windows you are not allowed to remove an open file.
|
||||||
|
close_all_descriptors();
|
||||||
|
}
|
||||||
|
|
||||||
for (this->current_ = this->plugins_.begin();
|
for (this->current_ = this->plugins_.begin();
|
||||||
this->current_ != this->plugins_.end();
|
this->current_ != this->plugins_.end();
|
||||||
++this->current_)
|
++this->current_)
|
||||||
|
Loading…
Reference in New Issue
Block a user